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?
LVL 3
apnamianAsked:
Who is Participating?
 
Raju SrivatsavayeConnect With a Mentor Software EngineerCommented:
Well ,FileUpload does not work with Update Panel. I tried other ways but ended up keeping it outside the update panel. You can refer to this forums link if you want to experiment.
http://forums.asp.net/p/991735/1301938.aspx#1301938
0
 
murkingCommented:
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.
0
 
Mayank_AgarwalCommented:
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
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
murkingCommented:
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!
0
 
nsg888Commented:
Just to say thanks to murking - your solution of a nested update panel and triggers worked great for me.
Thanks
0
 
murkingCommented:
thanks nsq888!

I'm glad it helped you
0
 
Randy Wilson.Net DeveloperCommented:
This guy has figured out all the permutations ->   http://marss.co.ua/FileUploadAndUpdatePanel.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.