I’m posting this article with reference to the request from my friends and for all other world wide asp.net lovers and especially for programmers who are in need of a solution for asp.net FileUpload control inside Ajax UpdatePanel. We often face problem with FileUpload control when its placed inside Ajax UpdatePanel. There is a simple trick for it to make it upload without any issues :).
ASP.Net FileUpload control needs a full Page PostBack to upload file and proceed further. The simplest solution to use UpdatePanel is by adding PostBackTrigger to the updatepanel as shown below.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Please upload your file: <br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button runat="server" ID="btnSubmit" Text="Upload"
onclick="btnSubmit_Click" />
<br />
<asp:Label runat="server" ID="lblFileDetails" Text=""></asp:Label>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>I’m presenting you a simple example with both HTML source code and C# code behind files which is coded for Microsoft .Net Framework 3.5 (Visual Studio 2008).
You can download from: FileUploadInsideUpdatePanel






Recent Comments