Code:
datagridview1.datasource=//your class function name
datagridview1.datasource=//your class function name
public static void WriteExcel(DataTable dt_Excel)
{
StringBuilder swColSb = new StringBuilder();
using (StreamWriter sw2Excel = File.CreateText(FileName.xls))
{
//get the Columns of the DataTable in the 1st Line
for (int i
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + exportfile.FileName + "");
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.ContentType
Leave a comment: