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

Select whole column

Thread ID:





46943 Jul 25,2006 02:01 PM UTC Jul 26,2006 10:17 AM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On July 25, 2006 02:01 PM UTC


I have got a GGC. Now I want to select the whole column with a click on the columnheader. So my question is, where can I set the click event for the column header and how can I select the whole column programmatically?

Thanks for your help

Administrator [Syncfusion]
Replied On July 26, 2006 05:41 AM UTC


There are two types of selection modes available for GridGroupingControl. One is inherited from the GridControlBase and the other is record based selection, that is specfic to the GridGroupingControl. Refer to the KnowledgeBase(KB) article link below for more details on this.


However, neither of the above mentioned selection modes will allow you to select columns. But TableControlCellClick event can be handled to do this. Below is the code snippet.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any; // Form_Load
ArrayList selectedColumns = new ArrayList();
private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex,e.Inner.ColIndex)
if(style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
GridRangeInfo range = GridRangeInfo.Col(e.Inner.ColIndex);
range = range.ExpandRange(2, e.Inner.ColIndex, e.TableControl.Model.RowCount, e.Inner.ColIndex);
e.TableControl.Selections.SelectRange(range, false);
e.TableControl.Selections.SelectRange(range, true);

Here is a sample http://www.syncfusion.com/Support/user/uploads/GGC_CompareData_d2e886a8.zip

To select a column programatically use the code below.
// selects first column...
this.gridGroupingControl1.TableModel.Selections.Add(GridRangeInfo.Cells(2,1,this.gridGroupingControl1.TableModel.RowCount, 1));

Let us know if you have any other questions.

Administrator [Syncfusion]
Replied On July 26, 2006 10:17 AM UTC

Thank it works


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