[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 825
  • Last Modified:

FileUpload keep filename/path after isPostBack vb.net

Hello folks, I've a little problem  and I dont know how to fix it.
I've a form with a fileupload and a radiobuttonlist.
I need to select a file in my FileUpload then I need to select a radio button, then my radio button open a Panel with options. So I've an autoPostBack = true
But when I clicked the radio button I lost the filename in my fileupload.

How I can keep the path/filename in my fileupload after the postback ??

Thanks for any help
1 Solution
I'm not very sure of how vb.net manages form posting, but I supose that the autoPostBack sends info in your form to your server. This posting probably reloads your client form, you don't lose the radio button value because you're passing it to the server and managing it on form load, you should do the same with the value on the File upload.

File uploads are also a bit "special", maybe you can't send it's value through the same POST action, then you could try to keep a hidden text input with the string value of the file selected and use this input to send the info through the POST action.

Remember to manage the FileUpload information in your form when you load it.
fileupload controls do not retain the file path value between postbacks due to security reasons, nothing you can do about it. Only option you can do is either use ajax and put the radio buttons and panel inside an update panel, or you can use javascript to show the panel when a radio button is selected.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now