Detecting column reorder with Visual Basic

2 posts, 1 answers
  1. David
    David avatar
    15 posts
    Member since:
    Jun 2014

    Posted 04 Dec 2014 Link to this post

    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
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 05 Dec 2014 Link to this post

    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.

     
Back to Top