Why PostedFile doesnot works in UpdatePanel? [Resolved]

Posted by Amatya under ASP.NET on 3/17/2016 | Points: 10 | Views : 225 | Status : [Member] | Replies : 3
Why PostedFile doesnot works in UpdatePanel? The code is in .asp page.

Feel free to share informations 9731764134
Thanks



Responses

Posted by: A2H on: 3/17/2016 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
If you are uploading files with FileUpload Inside Ajax UpdatePanel, Upload fails because few controls doesn't work with Ajax Partial postbacks.

If you still want to use fileUpload control with update panel then You need to set trigger for updatepanel like given below

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" Width="310px
<asp:Button runat="server" ID="UploadButton" Text="Upload" OnClick="UploadButton_Click" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="UploadButton" />
</Triggers>
</asp:UpdatePanel>

Note that this cause the entire page to trigger normal postback.

Thanks,
A2H
Please mark my reply as answer if it helps to resolve your problem

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 3/17/2016 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
Another option is to use the Ajax File Upload control from the Ajax control toolkit instead of asp FileUpload control which will work with update panel also.

http://csharpdotnetfreak.blogspot.com/2012/08/aspnet-ajaxfileupload-control-dragdrop-progress-bar.html

Thanks,
A2H
Please mark my reply as answer if it helps to resolve your problem

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amatya on: 3/17/2016 [Member] Bronze | Points: 25

Up
0
Down
Thanks man .. I got

Feel free to share informations 9731764134
Thanks

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response