Below is my code:-
public void ExportToExcel()
{
DataTable dataTab = BindListItemToDataTable();
if (dataTab.Rows.Count > 0)
{
string fileName = "ExportItems.xls";
System.IO.StringWriter strWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(strWriter);
DataGrid grid = new DataGrid();
grid.DataSource = dataTab;
grid.DataBind();
grid.RenderControl(htmlWriter);
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + "");
this.EnableViewState = false;
Response.Write(strWriter.ToString());
Response.End();
}
}
When I click first time on Download button It works fine, but again I click on same button or any other button on the form then event not riseing (Paused). Please help me out in this.
Thanks,
Vishwa