I am trying to get data from the rows that are generated in a GridView. Here is my table:
protected void viewStoryTime_OnRowDataBound(Object sender, GridViewRowEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.Row.Cells[0].Text);
}
The output is:
Hours 6.25 3 5 4
I however need the data from the date column. But when I do:
protected void viewStoryTime_OnRowDataBound(Object sender, GridViewRowEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.Row.Cells[2].Text);
}
I get the following error:
System.ArgumentOutOfRangeException was unhandled by user code
Specified argument was out of the range of valid values.
Parameter name: index
I don't understand what I am doing wrong.