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

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 12:55 PM

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


LM Lan Mo May 30, 2005 08:11 AM

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 09:39 AM

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


LM Lan Mo May 30, 2005 10:47 AM

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 11:30 AM

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 01:25 PM

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