FileUpload Not Working in the Wizard
-
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.
-
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.
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 -
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 -
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.
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