I have created a find function for a grid grouping control table. I am able to search the datatable and ‘find’ the correct datarow. I then want to set that cell to the current cell, in the datarow by using :-
I realise I can get the column number by using:-
int colnum = this. gridgroupcontrol.TableDescriptor.VisibleColumns.IndexOf("Column1");
But how do I find out the row index of the displayed rows, from a known datarow?
ADAdministrator Syncfusion Team October 4, 2004 12:30 PM UTC
Given the row index of the DataRow you can do the following:
Record r = Table.UnsortedRecord[dataRowIndex];
int gridRowIndex = Table.DisplayElements.IndexOf(r);
DLDavid LlewellynOctober 4, 2004 09:41 PM UTC
This doesnt seem to work for me. Both
Record r = this.gridgroupcontrol.Table.UnsortedRecords[rowindex];
Record r = this.gridgroupcontrol.Table.Records[rowindex];
return the same record. But the record returned is not the correct one. Obviously the row index is incorrect.
What I am doing is searching the underlying datasource for a certain string, which gives me an index. I then want to be able to convert the underlying data source index into a row index for the visible rows. Is there anyway to do this conversion directly without doing further searches for the unsorted table''s row index ??
ADAdministrator Syncfusion Team October 5, 2004 06:29 AM UTC
Here is a try at doing what I think you are describing. It finds a string in the underlying datatable, and then uses the code that Stefan suggested to find the corresponding grid row. It then uses PrepareViewStyleInfo to color the found row. (The grid row count takes into account things like DropArea and Caption and Headers and AddNewRow so the first row from teh datatsource has index 4.)
DLDavid LlewellynOctober 5, 2004 08:07 PM UTC
Thanks for the example. That is exactly what I needed.