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

Disable Drag Columns and columns width change

Thread ID:





94364 May 10,2010 09:24 AM UTC May 20,2010 01:20 PM UTC WinForms 1
Tags: GridControl
Ruslan Gasanbekov
Asked On May 10, 2010 09:24 AM UTC


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.

Arulraj A [Syncfusion]
Replied On 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.



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

or the page will be automatically redirected to 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