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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl - Quickly Select All the records

Thread ID:





40626 Feb 8,2006 01:44 PM UTC Feb 9,2006 11:22 AM UTC WinForms 4
Tags: GridControl
Badri Rajani Kanth
Asked On February 8, 2006 01:44 PM UTC

HI, I am using GGC. When user opts for "Select All" option, i have to select all records in thr GGC. Currently I am using the below code. foreach (Record record in GGC.Table.Records ) { GGC.Table.SelectedRecords.Add(record); } But, when the grid is having thousands of records, this code is slow. I am wondering is there any single method like SelectAllRecords()/AddAllRecords to the SelectedRecords collection? (as we have GGC.Table.SelectedRecords.Clear() ).. Plz inform me. Rgds Badri Rajani Kanth

Administrator [Syncfusion]
Replied On February 8, 2006 02:28 PM UTC

Hi Badri, You can use the SelectRange method to select all the records in the Grid. Here is the code snippet. // To select particular records this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Rows(5,this.gridGroupingControl1.TableControl.Model.RowCount),true); // To select the table this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Table(),true); Let us know if you need further assistance, Regards, Madhan.

Badri Rajani Kanth
Replied On February 8, 2006 02:41 PM UTC

Hi Madan, I tried with SelectRange earlier. But firstly, as selection using SelectRange is making the grid selection in black color.(gridGroupingControl1.Table.SelectedRecords.Add(record) selects in blue color). I dont know if there any other differences with SelectRange. As I am using many events (ex SelectedRecordsChanging), I am not sure if there can be any impact on my screen. PLz let me know. Rgds Rajani Kanth >Hi Badri, > >You can use the SelectRange method to select all the records in the Grid. Here is the code snippet. > >// To select particular records >this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Rows(5,this.gridGroupingControl1.TableControl.Model.RowCount),true); > >// To select the table >this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Table(),true); > >Let us know if you need further assistance, > >Regards, >Madhan.

Administrator [Syncfusion]
Replied On February 9, 2006 05:17 AM UTC

Hi Badri, If you do not set the selection flag then, the selection will become black. Here is the code snippet to avoid this. this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any; this.gridGroupingControl1.TableModel.Selections.SelectRange(GridRangeInfo.Rows(5,this.gridGroupingControl1.TableControl.Model.RowCount),true); Refer this sample for details Let us know if you need further assistance, Regards, Madhan

Badri Rajani Kanth
Replied On February 9, 2006 11:22 AM UTC

Hi, We are using : TableOptions.AllowSelection = GridSelectionFlags.None; TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; And ours is new record selection mechanism and we are using Table.SelectedRecords collection at many places in the application. Many related events are handled in the application. And also, this is what I have read in Synchfusion documentation. ------------------------------ Starting version 3.x the GridGroupingControl now supports multiple record selection and navigation across nested tables. In order to use the new record selection mechanism you need to set TableOptions.ListBoxSelection = SelectionMode.XYZ and make sure that TableOptions.AllowSelection = GridSelectionFlags.None. Optional settings can be specified with TableOptions.ListBoxSelectionColorOptions and TableOptions.ListBoxSelectionCurrentCellOptions. With the new record-based selection mode selected records can be found in Table.SelectedRecords collection. If you specify a different value for TableOptions.AllowSelection other than GridSelectionFlags.None the grid will operate in a backward-compatible mode and continue to use the old selection mechanism that was in place with 2.x and 1.x versions of the GridGroupingControl. Use TableOptions.AllowSelection only if you explicitly want the old selection behavior, e.g. if you want to be able to select individual cells or want to use Excel-like selection behavior. With the backward compatible selection mode selected rows and cells can be found in TableModel.Selections.Ranges collection. ------------------------------ So, I am affraid, If I change the selection back to old selection mechanism(by changing TableOptions.AllowSelection), there can be problems with lots of functionalities. I may need to re-test and re-write a lot. This is why I am not working with selectionchanging methods. Please let me know if there is a way.. Rgds Rajani Kanth


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon