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

How can I select column in GridControl from code?

If user select column 1, I need to select 3, 5, 7, 9 columns. Best regards.

1 Reply

AD Administrator Syncfusion Team June 16, 2004 07:42 AM UTC

One way you can do this is to handle the SelectionsChanged event.
private void gridControl1_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
	if(e.Range.Equals(GridRangeInfo.Col(1)))
	{
		this.gridControl1.Selections.SelectRange(GridRangeInfo.Col(3), true);
		this.gridControl1.Selections.SelectRange(GridRangeInfo.Col(5), true);
		this.gridControl1.Selections.SelectRange(GridRangeInfo.Col(7), true);
		this.gridControl1.Selections.SelectRange(GridRangeInfo.Col(9), true);
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon