We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Locate a row

I have GridGroupingcontrol form. I want to set cursor to a specific row. I used following code, it works, but very slow. Any idea or sample? regards, lan //locate the line by sect_no try { //mFormParam.RowLocate="sect_no LIKE ''100001''" gdBase.TableDescriptor.RecordFilters.Add(mFormParam.RowLocate); GridRecord rec = gdBase.Table.FilteredRecords[0] as GridRecord; gdBase.TableDescriptor.RecordFilters.Clear(); int row = gdBase.Table.DisplayElements.IndexOf(rec); int col = gdBase.TableDescriptor.VisibleColumns.IndexOf(mFormParam.ColName)+1+mFormParam.ColOffset; gdBase.TableControl.CurrentCell.MoveTo(row, col); gdBase.TableControl.SetTopRow(row); // highlighte the row gdBase.Table.CurrentRecord = rec; } catch { gdBase.TableDescriptor.RecordFilters.Clear(); gdBase.TableControl.CurrentCell.MoveTo(1, 1); }

6 Replies

AD Administrator Syncfusion Team May 27, 2005 05:55 PM UTC

Just setting: this.gridGroupingControl1.Table.CurrentRecord = rec; should scroll it into view without doing anything else.


LM Lan Mo May 30, 2005 01:11 PM UTC

I tried this code: //mFormParam.RowLocate="[field_name]LIKE ''sect_no''" gdBase.TableDescriptor.RecordFilters.Add(mFormParam.RowLocate); GridRecord rec = gdBase.Table.reFilteredRecords[0] as GridRecord; // highlighte the row gdBase.Table.CurrentRecord = rec; Could you give me a sample? Thanks, Lan >Just setting: > >this.gridGroupingControl1.Table.CurrentRecord = rec; > >should scroll it into view without doing anything else.


AD Administrator Syncfusion Team May 30, 2005 02:39 PM UTC

http://www.syncfusion.com/Support/user/uploads/GGC_SelectARecord_f51387ea.zip


LM Lan Mo May 30, 2005 03:47 PM UTC

I tried your sample. It is different from what I want to do. I want find a row by primary key''s id, such as "col1=2014", not by record sequence number. Thanks, >I tried this code: >//mFormParam.RowLocate="[field_name]LIKE ''sect_no''" >gdBase.TableDescriptor.RecordFilters.Add(mFormParam.RowLocate); >GridRecord rec = gdBase.Table.reFilteredRecords[0] as GridRecord; >// highlighte the row >gdBase.Table.CurrentRecord = rec; > >Could you give me a sample? > >Thanks, > >Lan > > >>Just setting: >> >>this.gridGroupingControl1.Table.CurrentRecord = rec; >> >>should scroll it into view without doing anything else.


AD Administrator Syncfusion Team May 30, 2005 04:30 PM UTC

You can use the this.gridGroupingControl1.Table.PrimaryKeySortedRecords.FindRecord method to find a record index using a primary key value. http://www.syncfusion.com/Support/user/uploads/GGC_SelectARecord_8399d16a.zip


LM Lan Mo May 30, 2005 06:25 PM UTC

Clay, Thanks for you sample. Now my code works Lan >You can use the this.gridGroupingControl1.Table.PrimaryKeySortedRecords.FindRecord method to find a record index using a primary key value. > >http://www.syncfusion.com/Support/user/uploads/GGC_SelectARecord_8399d16a.zip >

Loader.
Live Chat Icon For mobile
Up arrow icon