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

RadList Control SelectedIndexChanged initiall not working

2 Answers 176 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
SachinC
Top achievements
Rank 1
SachinC asked on 18 Nov 2010, 02:20 PM
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 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 18 Nov 2010, 06:32 PM
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
0
Peter
Telerik team
answered on 23 Nov 2010, 04:26 PM
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.
Tags
ListControl
Asked by
SachinC
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Peter
Telerik team
Share this question
or