6 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 14 Jan 2011, 12:24 PM
Hi Raymond,
Hope you're well.
This should stop the first column being re-ordered
Hope that helps
Richard
Hope you're well.
This should stop the first column being re-ordered
this.radGridView1.Columns.CollectionChanging += new NotifyCollectionChangingEventHandler(Columns_CollectionChanging);private void Columns_CollectionChanging(Object sender, NotifyCollectionChangingEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Move) { if (e.OldStartingIndex == 0) { e.Cancel = true; } } }Hope that helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 14 Jan 2011, 02:39 PM
Hi again Raymond,
Actually, the below works better... the above would fail if you re-order one of the other columns to the 0 indexed position.
However, the limitation to this is that if you pin a different column to the left, then it will still replace the 0 indexed column.
Richard
Actually, the below works better... the above would fail if you re-order one of the other columns to the 0 indexed position.
this.radGridView1.Columns.CollectionChanged += new NotifyCollectionChangedEventHandler(Columns_CollectionChanged); private void Columns_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) { if (this.radGridView1.Columns["Id"].Index != 0) { this.radGridView1.Columns.Move(this.radGridView1.Columns["Id"].Index, 0); } }However, the limitation to this is that if you pin a different column to the left, then it will still replace the 0 indexed column.
Richard
0
Raymond
Top achievements
Rank 1
answered on 14 Jan 2011, 03:33 PM
I changed your code a little:
and it works fine.
Thanks for help.
if (e.Action == NotifyCollectionChangedAction.Move) { if ((e.OldStartingIndex == 0) || (e.NewStartingIndex == 0)) { e.Cancel = true; } }and it works fine.
Thanks for help.
0
Richard Slade
Top achievements
Rank 2
answered on 14 Jan 2011, 03:35 PM
Yep, that would do it. Glad I could help
All the best
Richard
All the best
Richard
0
Shashikant
Top achievements
Rank 1
answered on 22 Jan 2013, 01:24 PM
How to achieve same behaviour in javascript.
0
Hello Shashikant,
Thank you for writing.
This forum concerns RadControls for WinForms, and your question seems to be unrelated to it. Please address it to the appropriate forums: RadGridView for ASP.NET AJAX.
Greetings,
Stefan
the Telerik team
Thank you for writing.
This forum concerns RadControls for WinForms, and your question seems to be unrelated to it. Please address it to the appropriate forums: RadGridView for ASP.NET AJAX.
Greetings,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
