This is a migrated thread and some comments may be shown as answers.

Column chooser event capture

1 Answer 143 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Shruti
Top achievements
Rank 1
Shruti asked on 29 Sep 2012, 05:58 AM
Hi,
I have a grid with around 40 columns. I have kept the column chooser element active for this grid. Now i have some operations to perform every time a column is added or removed from column chooser. How can i implement this? I tried with the grid paint vent but it causes a delay due to looping checks. Can you suggest me a good alternative please.

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 29 Sep 2012, 08:39 AM
Hi Shruti,

You can catch the moment when a column gets into the column chooser or gets out of it by subscribing to the PropertyChanged event of each column and checking whether the event is fired for the IsVisible property:
foreach(GridViewDataColumn col in this.radGridView1.Columns)
{
    col.PropertyChanged += new PropertyChangedEventHandler(col_PropertyChanged);
}
 
void col_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    if (e.PropertyName == "IsVisible")
    {
        GridViewDataColumn column = sender as GridViewDataColumn;
        Console.WriteLine(column.Name);
    }
}

I hope this helps.

Kind regards,
Nikolay
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Shruti
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or