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

Input control in .Net?

Is there a better control to use than the html 'input' in .Net?
I have a Wizard in my ASP.NET 2.0 Visual Basic website and I have an Input control (to allow users browse for a file).
Thsi works fine but when I go back and forward through the wizard pages the value selected disappears.
<Input ID="inpSupportingDocumentation" Type="File" RunAt="Server" size="35">

Open in new window

1 Solution
this is a control for asp.net.

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

- the issue is that html input lost it state after postback
- asp.net textbox retain its state after the postback

As the type of the input control you mentioned is set to file, i think you are looking for control for uploading. In that case, its the asp:FileUpload control. This is a complete control with a textbox and a browse button which automatically allows user to select a file for upload and puts the path in the textbox. It even automatically uploads the file for you.
Obadiah ChristopherCommented:
Well the file Upload control should be used..

@kerwinsiy... I think u missed the entire question, it says file upload not text input

<asp:FileUpload id="FileUpload1" runat="server"> </asp:FileUpload>

Open in new window

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

amoranAuthor Commented:
Thanks guys

Yes informaniac you're right that's what I'm after.
I notice that the FileUpload control doesn't maintain it's values across pages in a Wizard too!
A TextBox Control does though.

Strange eh?
That's deliberate by the way for security reasons. Viewstate travels on the wire back and forth between server and client and microsoft did not want users file system paths to travel that way.
I think i mentioned the FileUpload control before Informaniac did!!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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