Thank you for writing.
If I understand your requirement correctly you want the checked rows (by a certain GridViewCheckBoxColumn
) to be marked as selected when setting the DataSource
. Looping the Rows
collection is the appropriate solution to iterate all data rows and manipulate the selected state for the row when initializing the grid. There is no other suitable solution for handling this synchronization. I would like to note that in order to optimize performance when iterating the rows it is recommended to use the BeginUpdate
var cellValue = row.Cells[
However, if it is not the exact requirement please specify in details what is the exact goal that you are trying to achieve. A sample screenshot would be also very useful to get a better understanding of the precise case. Thank you ina dvance.
I hope this information helps. Should you have further questions I would be glad to help.