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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Coverd Cell

Thread ID:





14699 Jun 2,2004 05:06 PM UTC Jun 2,2004 07:32 PM UTC WinForms 3
Tags: GridControl
Asked On June 2, 2004 05:06 PM UTC

I have few header cells (both in row and column) as covered cell. I need help to achieve the following. If a user click on one of the covered cell in column or row header I need to select all the column (based on covered cell) or all the rows (based on covered cell). Let me try putting an example: this.programGrid.Model.CoveredRanges.Add(GridRangeInfo.Cells(0,1,0,2)); this.programGrid.Model.CoveredRanges.Add(GridRangeInfo.Cells(0,5,0,7)); So if they click either on column 1 or 2 it should select both (1,2) columns. If they click one on the 5,6 & 7 column then it should select all three(5,6,7) columns. I think it should be doable but need little direction. Thanks

Administrator [Syncfusion]
Replied On June 2, 2004 05:59 PM UTC

You can handle the SelectionsChanging event and adjust e.Range if the selection intersects a coveredcell. Here is a try at this.
private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
	if(!e.Range.IsEmpty && e.Range.IntersectsWith(GridRangeInfo.Row(0)))
		GridRangeInfo range = e.Range.IntersectRange(GridRangeInfo.Row(0));
		range = this.gridControl1.CoveredRanges.FindRange(0, range.Left);
			e.Range = GridRangeInfo.Cols(range.Left, range.Right);

Replied On June 2, 2004 07:01 PM UTC

Thanks. It is working except that it does not select “First” cell. If covered range is (0,5,0,7) then does not matter where I click (on column 5,6 & 7) it does not select cell[0,5]. I would appreciate your reply! Thanks

Administrator [Syncfusion]
Replied On June 2, 2004 07:32 PM UTC

This is by design. When you select a range of cells, the current cell is not selected. If you do not want this behavior, you can handle CurrentCellActivating and cancel it if you are trying to activate a header cell.
private void gridControl1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e)
	if(e.RowIndex == 0)
		e.Cancel = true;


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

Live Chat Icon For mobile
Live Chat Icon