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.

How to Remove a Column from Visible Columns Collection by Dragging its Column Header from GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

53250 Dec 11,2006 11:59 AM Dec 12,2006 08:49 AM Windows Forms 4
loading
Tags: GridControl
Vijaya Kumar Reddy
Asked On December 11, 2006 11:59 AM

Hi,

We want to Remove a Column from Visible Columns Collection by Dragging its Column Header out of the GridGroupingControl.

Please let me know how we can do that.

Regards
Vijay

Administrator [Syncfusion]
Replied On December 11, 2006 07:35 PM

Hi Vijay,

If you want to remove a column from the VisiblColumns collection, when the column is dragged to the griddroparea, then try the code below in the TableDescriptor.GroupedColumns.Changing event handler. This will help in hiding the column when its dragged to the dragdroparea and reshow it again once its being detached from group.

private void GroupedColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
SortColumnDescriptor scd = e.Item as SortColumnDescriptor;
if(e.Action == Syncfusion.Collections.ListPropertyChangedType.Remove)
{
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add(scd.Name);
}
else if(e.Action == Syncfusion.Collections.ListPropertyChangedType.Insert)
{
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove(scd.Name);
}
}

Please try the attached sample that demontrates this.
Here is a sample GGC_GroupColumns.zip
Let us know if this is not what you needed.
Regards,
Rajagopal

Vijaya Kumar Reddy
Replied On December 12, 2006 05:13 AM

Hi,

The solution you have given is to group by that column and to hide that column when it is grouped. This is not the solution I expected.

I dont want to group by that column but want to remove that column when we drag that column header outside the Grid Control bounding area. A simple example is removing the column from the outlook inbox by dragging it away from the column header row. I want the equivalent functionality like this.

Regards
Vijay

Administrator [Syncfusion]
Replied On December 12, 2006 07:30 AM

Hi Vijay,

Here is a small sample that shows you "How to remove the column by dragging its Column Header out of the grid". It uses the TableControl.MouseUp event to remove the columns from the Grid. Please try the attached sample and let me know if you are looking something different.

Sample : GGC_GroupColumns.zip

Best Regards,
Haneef

Vijaya Kumar Reddy
Replied On December 12, 2006 08:49 AM

Hi,

Thanks for the sample. It works fine.

I made changes not to remove that column when it is getting groped by dropping it to the GroupDropArea. Also when we rearrange the columns.

Regards
Vijay

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.

;