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 only drag the last column

Good morning, I have a problem with the GridGroupingControl

I've been looking for information in the forum but I have not found anything

I only want to get  block or disable drag the last column

Thanks in advance

1 Reply

AS Amresh S Syncfusion Team April 26, 2016 09:31 AM UTC

Hi Moises, 
 
Thank you for using Syncfusion products. 
 
Query 
Solution 
I only want to get  block or disable drag the last column 
Solution 1: 
We can restrict the dragging of a specified column by using the event, TableControlQueryAllowDragColumn. The AllowDrag property can be set as “false” depending upon the specified column. Please refer to the below code snippet. 
 
Code Example: 
// Trigger the required event. 
this.gridGroupingControl1.TableControlQueryAllowDragColumn += new GridQueryAllowDragColumnEventHandler(gridGroupingControl1_TableControlQueryAllowDragColumn); 
// Determine the last column and then restricting. 
void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e) 
{ 
   if (this.gridGroupingControl1.TableDescriptor.VisibleColumns.IndexOf(e.Column) + 1 == this.gridGroupingControl1.TableDescriptor.VisibleColumns.Count) 
    e.AllowDrag = false; 
} 
 
 
Solution 2: 
We can also restrict the dragging to a specified column by the following code, 
 
Code Example: 
// Trigger the required event. 
this.gridGroupingControl1.TableControlQueryAllowDragColumn += new GridQueryAllowDragColumnEventHandler(gridGroupingControl1_TableControlQueryAllowDragColumn); 
// Determine the last column and then restricting. 
void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e) 
{ 
  if (e.Column == "SampleData") // Specify the column to be restricted. 
      e.AllowDrag = false; 
} 
 
 
Please refer to the below attached sample and let us know your concerns. 
 
Sample: 
 
Regards, 
Amresh S. 


Loader.
Up arrow icon