RadList Control SelectedIndexChanged initiall not working

3 posts, 0 answers
  1. SachinC
    SachinC avatar
    23 posts
    Member since:
    Sep 2010

    Posted 18 Nov 2010 Link to this post

    Hello,

    Suppose, i am having the a RadListControl with 5 items.
    I programatically select two item from it before loading the form.
     

     

    For Each typeItem In LcChecklistType.Items
      If typeItem.Value = 1 OR typeItem.Value = 3 Then
          typeItem.Selected = True
      End If
    Next


    I have added handler progarmatically after this for each loop.
    now when the form is loaded completely.
    1.  if I "deSelect" the selected item say 1, the selectedindexchange event is not firing but the item is deSelected. now again back I Select the same item 1, then the event is fired.


    2. if I "Select" other item which is not selected say 2, then the event is fired.


    Help Appreciated.
    ASAP

     

     

    Thanks!
    Sachin


     

     

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

    Posted 18 Nov 2010 Link to this post

    Hi sachin,

    I think it would be better to subscribe to the radPropertyChanged event and capture if the Selected property has changed.
    for example

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each item As RadListDataItem In Me.RadListControl1.Items
            AddHandler item.RadPropertyChanged, AddressOf SelectedChanged
        Next
    End Sub
    Private Sub SelectedChanged(ByVal sender As Object, ByVal e As RadPropertyChangedEventArgs)
        If e.Property.Name = "Selected" Then
            Dim item As RadListDataItem = DirectCast(sender, RadListDataItem)
            MessageBox.Show(item.ToString() & " " & item.Selected.ToString())
        End If
    End Sub

    hope that helps, but let me know if you need more info.

    richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 23 Nov 2010 Link to this post

    Hello,

    Thank you for contacting us.

    As Richard has suggested, you should manually subscribe to the RadPropertyChanged event.

    Richard, your Telerik points have been updated for the assistance.

    I hope this helps.

    Sincerely yours,
    Peter
    the Telerik team
    Get started with RadControls for WinForms with numerous videos and detailed documentation.
Back to Top