Help with setting the SelectedItem on a DataboundListbox

3 posts, 1 answers
  1. GJ Kuz
    GJ Kuz avatar
    29 posts
    Member since:
    May 2011

    Posted 11 May 2012 Link to this post

    Dear Telerik Team,

    In the LayoutUpdated event of the page I am loading an observablecollection and binding to a radDataboundList box. I want to select an item from the listbox based on the userinput I am passing it to the page in the querystring. Once I set the datacontext, I am setting the selecteditem to the item from the observablecollection that I select based on the userinput. But setting the selecteditem is not triggering the selectionchanged event. Any idea why? I would like an item to be selected in the listbox based on the info I am getting from the previous page. how can I achieve this? Really apprciate some help on this.

     

    lstUnits.SelectedItem = viewModel.UnitCategories.Where(c => c.CategoryID == catID).FirstOrDefault();

    catID is extracted from the querystring.

    thanks,
    Gilles

     

     

  2. Answer
    Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 15 May 2012 Link to this post

    Hello Gilles,

     Thanks for writing.

    We have handled the support ticket you have opened regarding the same question.

    We will need some further details in order to be able to explain the behavior of your app. It is most probably the sequence in which you are binding the control and setting the selected item but this is just an assumption.

    Please take a look at the support ticket for further information.

    Thanks for your time.

    Regards,
    Deyan
    the Telerik team

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

  3. DevCraft banner
  4. GJ Kuz
    GJ Kuz avatar
    29 posts
    Member since:
    May 2011

    Posted 15 May 2012 Link to this post

    Thank you Deyan for getting back to me. As you mentioned, it was due to the order in which I was binding the control. Setting the selecteditem fires the SelectionChanged now. Thank you for pointing me in the right direction.

    thanks,
    Gilles
Back to Top