[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Input control in .Net?

Posted on 2008-11-04
6
Medium Priority
?
190 Views
Last Modified: 2010-04-14
Hi
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.
Thanks
AM
<Input ID="inpSupportingDocumentation" Type="File" RunAt="Server" size="35">

Open in new window

0
Comment
Question by:amoran
6 Comments
 
LVL 2

Expert Comment

by:kerwinsiy
ID: 22874697
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

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22875118
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.
0
 
LVL 20

Accepted Solution

by:
informaniac earned 80 total points
ID: 22875119
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

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:amoran
ID: 22876388
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?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22876525
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.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 22877691
I think i mentioned the FileUpload control before Informaniac did!!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question