Good Day All,
Is there a way to retrieve an ASP.Net gridview rowheader name at runtime?
I'm populating a Gridview automatically from a SQL stored procedure.
The values returned reflect a figure for a certain activity for a certain day for a certain company. You thus have a column with a list of company names, then (in this case) 29 columns reflecting dates from today until 28 days in the future. Under each date column, you have a figure representing the particular company's performance. The column names reflected today, will differ from the column names reflected tomorrow, hence my problem.
My users have to be able to click on a cell in the Gridview, and then be redirected to another page giving more information regarding the value reflected in the specific cell.
By using the RowDataBound option, I'm able to achieve this, but my problem is that I need to pass the actual header name (the date) of the cell clicked, as a variable.
Any ideas would be appreciated.
protected void GriView1_RowDataBound(Object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
int x = 29;
for (int i = 1; i <= x; i++)
// >> need to extract the headername here (??)
e.Row.Cells[i].Attributes.Add("onclick", "TestCheck(" + e.Row.Cells[i].Text.ToString() + "," + headername")");