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




Here we’ll see a simple web application to make use of iTextsharp to create pdf file with our own text. Create a web application and Add reference to the iTextShar.dll file which is extracted from the zip file downloaded from the above link. Create a folder inside your application called “PDF” to store our created pdf files. Design the Default.aspx with a multilined TextBox (to let user or we to enter our preferred text in paragraphs to appear in the pdf file) and a Button to trigger the code for pdf file creation as shown in the picture.






Recent Comments