Programatically selecting a row in Grouping Grid Control

User can select a row from the grid and edit the details and save it to the database. Once the save is done i need to programatically select/highlight the first row . Following code does it grid.BeginUpdate() grid.DataSource =null; grid.DataSource= ds; grid.Table.FilteredRecords[0].SetCurrent(); grid.EndUpdate(true); grid.Refresh(); Even though the first record gets selected with the above code, the previous selected row by the User is also highlighted. Please help me on this.

1 Reply

AD Administrator Syncfusion Team July 19, 2006 05:16 AM UTC

Hi Gopi, By calling Table.SelectedRecords.Clear() method after setting the datasource for the grid, resolves this problem. Change the code as below. grid.BeginUpdate() grid.DataSource =null; grid.DataSource= ds; grid.Table.SelectedRecords.Clear(); grid.Table.FilteredRecords[0].SetCurrent(); grid.EndUpdate(true); You can also select the records programatically using the code below. grid.Table.SelectedRecords.Add( grid.Table.Records[0] ); Let us know if you have any other questions. Thanks for using Syncfusion Products. Regards, Rajagopal

Loader.
Up arrow icon