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

Detecting column reorder with Visual Basic

1 Answer 7 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 04 Dec 2014, 05:50 PM
Hello,

I'm trying to figure out how to use the Telerik.WinControls.Data.ObservableCollection.CollectionChanging event to detect when a user moves columns in the grid.  How can you do this in Visual Basic.NET?  I need to do this so I can detect if we need to save the layout for that user to the database or not.

Kind regards,

David

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 05 Dec 2014, 04:43 PM
Hi David,

Thank you for writing.

Here is how to subscribe to the event:
AddHandler radGridView1.Columns.CollectionChanged, AddressOf radGridView1_CollectionChanged

and here is how to identify the move operation:
Private Sub radGridView1_CollectionChanged(sender As Object, e As Telerik.WinControls.Data.NotifyCollectionChangedEventArgs)
    If e.Action = Telerik.WinControls.Data.NotifyCollectionChangedAction.Move Then
        'a column has been moved from  e.OldStartingIndex to  e.NewStartingIndex. The column can be accessed in e.NewItems(0)
    End If
End Sub

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
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
David
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or