Add new item event in RadListControl

5 posts, 1 answers
  1. tran
    tran avatar
    8 posts
    Member since:
    Oct 2010

    Posted 20 Jan 2011 Link to this post

    Hi Telerik Team! I have a question about RadListControl. I have a RadListControl, which event will I catch up the event when a new RadListDataItem insert into my RadListControl ?

    Tran Dat
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 20 Jan 2011 Link to this post


    There are two ways for this. If you are binding to a datasource then you can use

    AddHandler Me.RadListControl1.ItemDataBound, AddressOf RadListControl_ItemDataBound
        Private Sub RadListControl_ItemDataBound(ByVal sender As Object, ByVal e As ListItemDataBoundEventArgs)
        End Sub

    or, when adding items, you can subscribe to the ItemsChanged event
    AddHandler Me.RadListControl1.ListElement.ItemsChanged, AddressOf RadListControl_ItemsChanged
        Private Sub RadListControl_ItemsChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.Data.NotifyCollectionChangedEventArgs)
            MessageBox.Show(CType(e.NewItems(0), RadListDataItem).Text)
        End Sub

    Hope that helps
  3. Eric
    Eric avatar
    7 posts
    Member since:
    May 2012

    Posted 06 Jul 2012 Link to this post


    I just have a tiny question for this:
    Do I have to add the handler manually at the code for the RadListControl_ItemsChanged Event?
    The ItemDataBound I can find at the NavigationBar, but not the ItemsChanged (Maybe because it's from the ListElement Property)

    Is that right?
    Thanks in advance,
  4. Eric
    Eric avatar
    7 posts
    Member since:
    May 2012

    Posted 06 Jul 2012 Link to this post

    Also, this event, the ItemsChanged, has being triggered unstoppable until I get a stack overflow. Is this the right event to catch the add of an ListItem in the list? (In this particular case I'm not working with a Data Binding).

  5. Stefan
    Stefan avatar
    2911 posts

    Posted 10 Jul 2012 Link to this post

    Hello Tran,

    Thank you for writing.

    Indeed the event belongs to the ListElement and you have to manually subscribe to it. 

    Yes, this is the right event to capture changes in an item. The event arguments allow you to check what is the action that triggered the event.

    I hope this information addresses your question. If there is anything else I can assist you with, do not hesitate to contact me.

    the Telerik team
    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Back to Top