Link to home
Start Free TrialLog in
Avatar of apnamian
apnamian

asked on

FileUpload is not working in UpdatePanel

Greetings,
I'm using the FileUpload in UpdatePanel of Ajax extension, but its not working. any idea what to do with it to get the problem solve?
ASKER CERTIFIED SOLUTION
Avatar of Raju Srivatsavaye
Raju Srivatsavaye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of murking
murking

Actually it can be done, as long as you use triggers, something like this:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" >
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="btnPostBack" runat="server" Text="My PostBack Button" OnClick="btnPostBack_Click" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnPostBack" />
</Triggers>
</asp:UpdatePanel>

Don't forget to include the enctype="multipart/form-data" in your <form> tag.
Hi
Good post!
But when i used your mthod it doesnt work for me. The Fileupload.Hasfile return false. but when i keep it outside the updatepanel no drama even with not including the enctype.
Any ideas
Mmm I forgot to mention that the updatePanel shown in my code, is a sub-UpdatePanel, that is, there should be another outer UpdatePanel around all your other code... hope this helps!
Just to say thanks to murking - your solution of a nested update panel and triggers worked great for me.
Thanks
thanks nsq888!

I'm glad it helped you
This guy has figured out all the permutations ->   http://marss.co.ua/FileUploadAndUpdatePanel.aspx