Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. FileUpload Not Working in the Wizard

FileUpload Not Working in the Wizard

Scheduled Pinned Locked Moved ASP.NET
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anada8886
    wrote on last edited by
    #1

    Hello All, I have a page on which I am using the wizard control.The finish button is on third step of the wizard. But i am having a FileUpload control in the first step itself.When I select a file in the FileUpload ,after clicking on Next,postback occurs and the Filename is lost. I need the FileUpload, not to loose the filename till the last step. I have tried saving the filename in viewstate,but since I need to pass the whole control in my method(which is predefined,and can not be changed),the viewstate solution didn't work. I also found 1 more solution on internet i.e. Manually add the enctype to the page's form on Page_Load() Page.Form.Attributes.Add("enctype", "multipart/form-data"); but it is also not working,might be because the form tag is on my MasterPage and not on the requiered page. Do anyone have any suggestion/solution to this problem? Please help.

    A 1 Reply Last reply
    0
    • A anada8886

      Hello All, I have a page on which I am using the wizard control.The finish button is on third step of the wizard. But i am having a FileUpload control in the first step itself.When I select a file in the FileUpload ,after clicking on Next,postback occurs and the Filename is lost. I need the FileUpload, not to loose the filename till the last step. I have tried saving the filename in viewstate,but since I need to pass the whole control in my method(which is predefined,and can not be changed),the viewstate solution didn't work. I also found 1 more solution on internet i.e. Manually add the enctype to the page's form on Page_Load() Page.Form.Attributes.Add("enctype", "multipart/form-data"); but it is also not working,might be because the form tag is on my MasterPage and not on the requiered page. Do anyone have any suggestion/solution to this problem? Please help.

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Hey.. dont add form Attributes, as ASP.NET handles the form itself. Your server side form is totally different than your client side form. Thus any attribute that you place in the server side form will not be reflected to the client side form. Just like your case, enctype, onsubmit etc etc are replaced by your page when it renders to its own form. :)

      Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
      Create .NET Templates

      A 1 Reply Last reply
      0
      • A Abhishek Sur

        Hey.. dont add form Attributes, as ASP.NET handles the form itself. Your server side form is totally different than your client side form. Thus any attribute that you place in the server side form will not be reflected to the client side form. Just like your case, enctype, onsubmit etc etc are replaced by your page when it renders to its own form. :)

        Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
        Create .NET Templates

        A Offline
        A Offline
        anada8886
        wrote on last edited by
        #3

        Thanks for your reply sir. But I still have not got the solution to my problem. Can please suggest anything else to solve it? I just want the FileUpload to retain its FileName till the last step of the wizard. Thank You.

        A 1 Reply Last reply
        0
        • A anada8886

          Thanks for your reply sir. But I still have not got the solution to my problem. Can please suggest anything else to solve it? I just want the FileUpload to retain its FileName till the last step of the wizard. Thank You.

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          Actually Input type file is the most problematic dom element I have ever seen. Just you cant open a file without the user to have selected through browse button. Even after choosing the file if you just append the control to another form using javascript, the file reference will be wacked up. I think what is the most viable thing to do, is to upload the file to the server when user chooses the file and then hold the context of the file in the server. Other Wayouts : Otherwise, I think you can embed a flash object in the browser to open files using flash open dialog box. Flash is more powerful in this regard. You can also use Silverlight, If you wish...

          Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
          Create .NET Templates

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups