Reputation: 83
I need to highlight or bookmark a particular row after refresh/setdatasource.
c1truedbgrid.bookmark = dataTable.AsEnumerable().Where(x => x.Field<string>("Col") == stringValue))
.
How can I get the index of the row in datatable with a string filter for a particular column?
Expected output
c1truedbgrid.bookmark = index of the particular with the a particular string value.
Upvotes: 0
Views: 409
Reputation: 2124
Check this thread. Here is one of the solutions:
dataTable.AsEnumerable().TakeWhile(x => x.Field("Col") != stringValue).Count();
However, working with datatables that is much more common to rely on identity column (primary key) rather than index. Representation in the grid might be in the different order than in the binded datasource.
Upvotes: 0