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

Enable Column Reordering

2 Answers 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ahmet Özgür
Top achievements
Rank 1
Ahmet Özgür asked on 05 Apr 2012, 08:53 AM

Hello,
When i tick "enable column reordering" from specific task it works fine. but i want to enable this from code. i tried the followings but did not work.
this.AllowColumnReorder = true;
this.MasterTemplate.AllowColumnReorder = true;
foreach (GridViewColumn item in this.MasterTemplate.Columns)
{
       item.AllowSort=true;
       item.AllowReorder = true;
       item.IsPinned = false;               
}
Can u help about this.
 

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 05 Apr 2012, 10:52 AM
Hi Ahmet,

Thank you for writing.

Please note that when you set the "Enable Column Reordering" to false at design-time, a false value is serialized in the designer for the AllowColumnReorder property. So, even if you set the AllowColumnReoder to true in the constructor of your extended RadGridView class, your true value will be overridden by the false value serialized in the designer. Your only option to override what is serialized in the designer is to override the EndInit method in your extended RadGridView class:

public class MyGrid : RadGridView
{
    public override void EndInit()
    {
        base.EndInit();
 
        this.AllowColumnReorder = true;
    }
}

I hope this helps. All the best,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Ahmet Özgür
Top achievements
Rank 1
answered on 05 Apr 2012, 11:41 AM
Thank you. It worked.
Tags
GridView
Asked by
Ahmet Özgür
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Ahmet Özgür
Top achievements
Rank 1
Share this question
or