Input control in .Net?

Posted on 2008-11-04
Last Modified: 2010-04-14
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

Question by:amoran
    LVL 2

    Expert Comment

    this is a control for

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

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

    LVL 83

    Expert Comment

    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.
    LVL 20

    Accepted Solution

    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


    Author Comment

    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?
    LVL 83

    Expert Comment

    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.
    LVL 83

    Expert Comment

    I think i mentioned the FileUpload control before Informaniac did!!!!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now