[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 14783
  • Last Modified:

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?
0
apnamian
Asked:
apnamian
1 Solution
 
Raju SrivatsavayeSoftware 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now