NeatUpload control loses viewstate on postback wo/validation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

NeatUpload control loses viewstate on postback wo/validation

Guest-1099
Hi Dean-

I have a page with NeatUpload/SqlUploader control that has worked great for a long while now. Recently
I needed to add a usercontrol to the page that has embedded controls with postback (no validation) processing,
and I have now run into the issue that the NeatUpload control does not maintain its viewstate on postbacks before
the form submission (and actual file upload). Here is what I have on my web form:

<SqlUpload:SqlServerInputFile ID="inputFile" Height="22px" size='100' runat="server" />

I tried setting the EnableViewState="true" on this control, but it doesn't change its behavior. If I select a file
with the open file dialog, then click a button on the usercontrol that executes a method on the server on post-
back, the form is re-rendered with the NeatUpload control empty.

Any ideas?

Thanks,
Glenn
Reply | Threaded
Open this post in threaded view
|

Re: NeatUpload control loses viewstate on postback wo/validation

Dean Brettle
Administrator
For security reasons, browsers don't allow web pages (e.g. those returned after a postback) to set the filename.  This is true for the standard ASP.NET FileUpload control, and any other file upload control that does not require installation of additional client-side software.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: NeatUpload control loses viewstate on postback wo/validation

Glenn Mason

Thanks for the explanation, Dean. Can you think of any possible workaround to get the viewstate maintained by this control. I could try some kind of manual workaround, but the FileName peoperty is not assignable so I'm at a loss there. Isn't there a way to initialize the control with a preselected filename? I would have guessed that somewhere out there someone would have a need to do that. If I don't have any ability whatsoever to assign the filename on page load, any worksaround, however kludy, would seem impossible.

Glenn

 

Reply | Threaded
Open this post in threaded view
|

Re: NeatUpload control loses viewstate on postback wo/validation

Dean Brettle
Administrator
If there were a way around this, it would be a browser security hole and any web page you visited could secretly upload files from your machine. --Dean