viewstate for a File Input Control

R

Robin

On an ASP.Net page that has viewstate enabled.
How do you enable viewstate for a server side file input control?
Currently I have in the HTML view.
<INPUT id="myID" type="file" name="myID" runat="server">
 
B

bruce barker

no need. the <input type=file> does not use viewstate as there it has no
data to store in viewstate.

-- bruce (sqlwork.com)


| On an ASP.Net page that has viewstate enabled.
| How do you enable viewstate for a server side file input control?
| Currently I have in the HTML view.
| <INPUT id="myID" type="file" name="myID" runat="server">
|
|
 
P

Patrice

What is the exact problem ?

By design you'll never be able to persist values in this control for safety
reasons (i.e. the only way to fill this control is to have the user select a
file).

Patrice
 
R

Robin

Is there another asp.net control that can be used to select a file that has
the viewstate option?
 
K

Kevin Spencer

Hi Robin,

I have seen a solution that uses an input type=file HTML element that is
hidden with a style. Over that is placed a text box and a button. When you
click the button, it clicks the hidden button in the hidden element (using
JavaScript), which pops up the file open dialog box. Once you select the
file, the value attribute of the file upload element is copied to the
textbox, again, using JavaScript. By using this technique you have
ViewState, and a more malleable user interface.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top