i can see the all data in the grid view. i can export data to excel. now i want to add serial number with each row. how can i do?
protected void btnDownLoad_Click(object sender, EventArgs e)
{
if (ViewState["MainTable"] != null)
{
DataTable dt = (DataTable)ViewState["MainTable"];
ExporttoExcel(dt);
}
}
private void ExporttoExcel(DataTable table)
{
DateTime time = DateTime.Now; // Use current time
string format = "ddMMyyyyhhmm";
string fileName = time.ToString(format);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ContentType = "appl ...
Go to the complete details ...