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

Restrict Drag For Individual Columns

Thread ID:

Created:

Updated:

Platform:

Replies:

33466 Aug 20,2005 08:15 AM Aug 22,2005 12:40 PM Windows Forms 3
loading
Tags: Grouping
Vinay
Asked On August 20, 2005 08:15 AM

Hi All, I am using a Grouping Grid[Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl], my requirement is to freeze first few columns depending upon the user choice. I am able to freeze cols at run time, but here one condition is the freezed columns should not be allowed to drag or moved. But the remaining columns in the grid should have drag & move facility. Is there any way to set Drag options for each individual columns. Thanks

Administrator [Syncfusion]
Replied On August 20, 2005 11:44 AM

You can try handling the TableControlMouseDown event and conditionally setting the AllowDragCols property there. private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e) { int row, col; if(e.TableControl.PointToRowCol(new Point(e.Inner.X, e.Inner.Y), out row, out col)) { GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(row, col); if(style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && style.TableCellIdentity.Column.Name == "Col1") { this.gridGroupingControl1.TableOptions.AllowDragColumns = false; } else { this.gridGroupingControl1.TableOptions.AllowDragColumns = true; } } }

Vinay
Replied On August 22, 2005 03:33 AM

This works fine when I try to drag the selected columns[Restricted Columns]. But when I try to drop any other column on the Restricted columns it fails. Here my Requirement For Eq I have 10 columns in my data source & 3 columns need to be freezed. Freezed Col should not be allowed to participate in drag /Drop , also other 7 columns should not be allowed to be droped on the 3 column. Can you provide me some events which will help me to achieve this functionality. Thanks >You can try handling the TableControlMouseDown event and conditionally setting the AllowDragCols property there. > >private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e) >{ > int row, col; > if(e.TableControl.PointToRowCol(new Point(e.Inner.X, e.Inner.Y), out row, out col)) > { > GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(row, col); > if(style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell > && style.TableCellIdentity.Column.Name == "Col1") > { > this.gridGroupingControl1.TableOptions.AllowDragColumns = false; > } > else > { > this.gridGroupingControl1.TableOptions.AllowDragColumns = true; > } > } >} >

Administrator [Syncfusion]
Replied On August 22, 2005 12:40 PM

Try handling the TableControlQueryAllowDragColumn event.
private void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
	if (e.InsertBeforeColumn != null 
		&& e.TableControl.TableDescriptor.VisibleColumns.IndexOf(e.InsertBeforeColumn) < 3)
	{
		e.AllowDrag = false;
	}
}

CONFIRMATION

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.

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.

;