I have kept an int element and char element as datakeys of gridview,first one being the int element.
But when I write the following code, error comes up stating that
"Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index"
Why does the error come up? and how to remove it? protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
Char s =Convert.ToChar(GridView1.DataKeys[e.Row.RowIndex]);
if (s == '0')
e.Row.BackColor = System.Drawing.Color.Red;
e.Row.BackColor = System.Drawing.Color.SeaGreen;
View Complete Post