I populate values from my gridview in my table using this Code:
Table table = new Table();
// get gridlines from gridview
table.GridLines = GridView1.GridLines;
if (GridView1.HeaderRow != null)
{
table.Rows.Add(GridView1.HeaderRow);
}
foreach (GridViewRow row in GridView1.Rows)
{
table.Rows.Add(row);
}
if (GridView1.FooterRow != null)
{
table.Rows.Add(GridView1.FooterRow);
}
What I need is to read every data from the table which contains the values of the gridview into an Excel worksheet cell. How can I achieve this?
PS: This is my worksheet obj in code-behind in C#.
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
Or Is there any other way to add the data from GridView to something else than, using table, which can be easily read?