By nature, FileUpload controls require an entire page postback to submit the file contents, so they are explicitly excluded from support within an UpdatePanel...however, if you put the Submit button that performs the postback intended to upload the file into a PostbackTrigger, you can place your FileUpload control within the UpdatePanel.
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:FileUpload runat="server" ID="fupTest" />
<asp:Button runat="server" ID="btnSubmit" Text="Upload"/>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>
Subscribe to:
Post Comments (Atom)
7 comments:
fgfg
Hai
File upload control in update panel the page is going to refresh while i am using Postback trigger with Control Id as Buttonn Id what should i do for eliminating this Page refresh
Any one suggest me
This doesn't work at all. Add an image above the update panel and you'll see that a postback still occurs
Adding the control to the Triggers list ensures that a postback occurs - it just makes sure it's a full-page postback, not a partial page (asynchronous) update.
I had found I still had a problem having put this in, but it turned out that I was adding the FileUpload control onto the page in an asynchronous callback, which meant that the form type wasn't multi-part, and had to add code like the following to ensure that the file was included with the postback (in addition to the Triggers entry):
if (!IsPostBack)
{
this.Page.Form.Enctype = "multipart/form-data";
}
thank you very much sir for your brilliant post
Thanks David .....its work
Post a Comment