Anand Solomon

Anand Solomon

  • NA
  • 78
  • 1.8k

Gridview get next and previous cells values

Feb 24 2020 1:36 AM
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)