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

Reordering the columns of grid

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Babak
Top achievements
Rank 1
Babak asked on 26 Jan 2015, 04:58 PM
We have a special toggle mode in our forms that if it is set to true, I don't want to be able to reorder the columns of the grid and otherwise want to allow reordering the columns.
I found the event ColumnReordering and the property CanUserReorderColumns
and used them as following:
The problem is that it works but not for the very first time of reordering the columns, for first time of reordering the columns it still allows it to be reordered but after that it works for other columns.



void MyGridView_ColumnReordering(object sender, ColumnReorderingEventArgs e)
{
    if (this.ThatToggleMode!= null)
    {
        if (this.InThatToggleMode)
        {
            this.CanUserReorderColumns = false;
            e.Handled = true;
        }
        else
        {
            this.CanUserReorderColumns = true;
        }
    }
}


1 Answer, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 29 Jan 2015, 10:06 AM
Hello Babak,

A possible way to solve this is to set initially the CanUserReorderColumns property of RadGridView to "False" in XAML or code-behind and then change it through your toggle mode.

On a side note for more information about reordering columns you can check the Reordering Columns documentation article.

I hope this helps. 

Regards,
Boris
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Babak
Top achievements
Rank 1
Answers by
Boris
Telerik team
Share this question
or