Guest User

Untitled

a guest
Jun 19th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. var excelXml = GetExcelXml(dsInput, filename);
  2. response.Clear();
  3. response.AppendHeader("Content-Type", "application/vnd.ms-excel");
  4. response.AppendHeader("Content-disposition", "attachment; filename=" + filename);
  5. response.Write(excelXml);
  6. response.Flush();
  7.  
  8. protected void btnExport_Click(object sender, EventArgs e)
  9. {
  10. try
  11. {
  12.  
  13. if (list.Count() > 0)
  14. {
  15.  
  16.  
  17. ds.Tables.Add(dtForExport);
  18. ExcelHelper.ToExcel(ds, filename); //To Excel method is described above.
  19. LoadGridDetails();//Binds the new values
  20.  
  21. }
  22.  
  23. }
  24. catch (Exception ex)
  25. {
  26. lblStatus.Text = "Error Exporting to Excel";
  27. }
  28. }//Screen is not refreshed after executing this line.
Advertisement
Add Comment
Please, Sign In to add comment