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

Help with setting the SelectedItem on a DataboundListbox

2 Answers 83 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
GJ Kuz
Top achievements
Rank 1
GJ Kuz asked on 12 May 2012, 01:01 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Deyan
Telerik team
answered on 15 May 2012, 08:35 AM
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 >>

0
GJ Kuz
Top achievements
Rank 1
answered on 15 May 2012, 01:49 PM
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
Tags
DataBoundListBox
Asked by
GJ Kuz
Top achievements
Rank 1
Answers by
Deyan
Telerik team
GJ Kuz
Top achievements
Rank 1
Share this question
or