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

Disable Drag Columns and columns width change

Hi,

I whould like to achive the following:

1. I got grid with couple of regual columns and couple with stacked header columns, the stacked header can be clicked and opened a new form. I whold like to prevent from changing the columns order, for that I use:
this.m_Grid.TableOptions.AllowDragColumns = false
but then when i click the stacked headers, the shadow of the cell click operation is gone. How can i achive this behavior and keep the shadow of the cell click operation?

2. How can I prevent the user from changing the columns width.

1 Reply

AA Arulraj A Syncfusion Team May 20, 2010 01:20 PM UTC

Hi Ruslan,

Thanks for your interest in Syncfusion Products.

1)To avoid dragging columns, you can handle the TableControlQueryAllowDragColumn event and cancel drag operation. The below code achieves this.

void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
if (e.Reason == GridQueryAllowDragColumnReason.HitTest)
{ e.AllowDrag = false;
e.Handled = true; }
}

We don’t find any issue while clicking in stacked header to display form. If you still see the issue, please implement it in the below sample and resend it to us.


2)To avoid the user from changing the columns width you need to use ColWidthsChanging event. The below code achieves this.

void Model_ColWidthsChanging(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeChangingEventArgs e)
{e.Cancel = true;}


Here is a sample for your reference.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DisableDragColumn-357361450.zip

Regards,
Arulraj.A

Loader.
Live Chat Icon For mobile
Up arrow icon