Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between RowIndex and DataItemIndex?

In gridview’s RowDataBound event has e.Row.RowIndex and e.Row.DataItemIndex properties.
Please tell me in easily understandable answer, what is difference between them?
In which situation we should use which one?

like image 478
jams Avatar asked May 17 '11 15:05

jams


2 Answers

Use the DataItemIndex property to determine the index of the DataItem in the underlying DataSet.
Use the RowIndex property to determine the index of the GridViewRow object in the Rows collection of a GridView control.

like image 67
jams Avatar answered Nov 13 '22 16:11

jams


e.Row.RowIndex return the index of the row that is currently under binding

e.Row.DataItemIndex contains all the data indexes of the rows that is currently under binding.

like image 4
Muhammad Akhtar Avatar answered Nov 13 '22 15:11

Muhammad Akhtar