1
Answer

Gridview get next and previous cells values

Anand Solomon

Anand Solomon

5y
1.9k
1
How to get a gridview row previous and next cell value on rowdatabound event. I tried this
 
GridViewRow prevRow = GridView1.Rows[e.Row.RowIndex - 1];
Label previousValue = prevRow.FindControl("SLNO") as Label;
 
But it throws an error like this
 
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
 
Thanks
Answers (1)