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.

Drag and Drop Multiple Columns in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

50658 Oct 16,2006 04:38 PM Oct 17,2006 01:58 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 16, 2006 04:38 PM

Can someone please tell me know to drag and drop multiple columns in GGC?

I wrote some custom code in TableControl_MouseDown to do column selection. Now I have multiple columns selected. How can I drag and drop these columns to a different location?

Thanks,

Frankie

Administrator [Syncfusion]
Replied On October 17, 2006 01:58 AM

Hi Frankie,

You can handle the TableControl.QueryAllowDragColumn todrag and drop multiple columns in Grid. Please refer to the attached sample for more details.

private void TableControl_QueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
if(e.Reason == GridQueryAllowDragColumnReason.MouseUp)
{
e.AllowDrag = false;

ArrayList SelectedColumnNames = new ArrayList();
int insertBeforeIndex = e.TableControl.TableDescriptor.VisibleColumns.IndexOf(e.InsertBeforeColumn);

if( insertBeforeIndex != -1)
{
foreach(GridRangeInfo columnRange in e.TableControl.Model.SelectedRanges )
{
for(int i = columnRange.Left;i<= columnRange.Right ;i++)
{
int fieldIndex = e.TableControl.TableDescriptor.ColIndexToField(i);
SelectedColumnNames.Add( e.TableControl.TableDescriptor.VisibleColumns[fieldIndex].Name);
}
}
for(int i = 0;i< SelectedColumnNames.Count;i++)
{
int sourceIndex = e.TableControl.TableDescriptor.VisibleColumns.IndexOf(SelectedColumnNames[i].ToString() );
if( sourceIndex != -1)
{
e.TableControl.TableDescriptor.VisibleColumns.Move(sourceIndex,insertBeforeIndex - i);
}
}
}
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/MultipleDragColumns_b31f4e3c.zip

If this did not help you to solve the problem, please modify the sample to show the problem.

Best Regards,
Haneef

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.

;