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.
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
;
}
}
}