Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > ComboBox and ListBox (obsolete as of Q2 2010) > RadCombobox SelectedIndexChanged fire when program add DataSource property

Not answered RadCombobox SelectedIndexChanged fire when program add DataSource property

Feed from this thread
  • Posted on Sep 19, 2011 (permalink)

    Dear All,

    I have 2 Radcombox
    Radcombox1 will bind data in Form_Load event  And  Radcombox2 will bind when user selected item at Radcombox1

    This is my code in Form_LoadRadcombox1.NullText = "- Select Name -"
    Radcombox1.DisplayMember = "Name"
    Radcombox1.ValueMember = "ID"
    Radcombox1.DataSource = dataTable
    Radcombox1.SelectedItem = vbNullString

    My problem is when add DataSource to Radcombox1 (Radcombox1.DataSource = dataTable)
    the Radcombox1_SelectedIndexChanged event is fire and it's also binding Radcombox2.

    Please suggest how to make it Binding Radcombox2, only when user selected Item at Radcombox1.

    Thanks and best regards


    *question re-post from TrialUser

    Reply

  • Peter Peter admin's avatar

    Posted on Sep 21, 2011 (permalink)

    Hi Avelyn Teh,

    Тhis a normal and expected behavior, because the DataSource changed the current position to 0, so the event should be fired. You can workaround this with a BeginUpdate/EndUpdate block:

    Radcombox1.NullText = "- Select Name -"Radcombox1.DisplayMember = "Name" 
    Radcombox1.BeginUpdate() 
    Radcombox1.ValueMember = "ID" 
    Radcombox1.DataSource = dataTable  
    Radcombox1.SelectedItem = vbNullString 
    Radcombox1.EndUpdate()
    I hope it helps. If you have any further questions, do not hesitate to contact me.

    Best wishes,
    Peter
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > ComboBox and ListBox (obsolete as of Q2 2010) > RadCombobox SelectedIndexChanged fire when program add DataSource property
Related resources for "RadCombobox SelectedIndexChanged fire when program add DataSource property"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]