Hi,
I wanna export the data into PDF/EXCEL. for PDF i'm using iTextSharp.dll, for EXCEL using HtmlTable. I wanna export the data using Ajax post.
Scenario:
I've a seperate button for Export data into Excel and PDF, when i click the button i wanna download the files appropriately without page load, so i've used the Ajax post method. the method was successfully called. but the files are not downloaded. can anyone assist me to get the solution.
My .aspx code:
<asp:Button ID="btnPDF" runat="server" Text="PDF" ToolTip="Download the PDF" onclick="btnPDF_Click" />
<asp:Button ID="btnEXECL" runat="server" Text="EXCEL" ToolTip="Download the EXCEL" onclick="btnEXECL_Click" />
Script Code:$("input[type='submit']").click(function (e) {var type = $(this).val();var url = "DownloadFile.aspx?type=" + type;$.post(url);});These code are placed inside the default.aspx page. From here i've called the "DownloadFile.aspx" using post method. the method is called and the files have been created but not download at the end.

Joginder BangerPosted Mar 24, 2015, 1:04 PM
It's really help me for download every type of format file.
Sathish KumarPosted Mar 24, 2015, 7:19 AM
Joginder BangerPosted Mar 24, 2015, 3:42 AM
Pdf
Excel
PathOfPage coding parts
page_loadEvent(object sender,Eventags e)
{
//get the type through the query string value....
downloadfunction(type);
}
public void downloadfunction(string type)
{
}
Sathish KumarPosted Mar 24, 2015, 3:06 AM
Vithal WadjePosted Mar 23, 2015, 1:30 PM
http://www.c-sharpcorner.com/UploadFile/0c1bb2/export-gridview-to-pdf/