3 Answers, 1 is accepted
0
Hello Fabian,
RadDataBoundListBox does not expose a SelectedIndex property by design. We decided that this property is not needed since you can easily acquire the index of the selected item by reading the value of the SelectedItem property and call IndexOf for this item on the source collection.
Could you please give us some further details about your scenario and why would you need to have this property?
Thanks for your time.
Best wishes,
Deyan
the Telerik team
RadDataBoundListBox does not expose a SelectedIndex property by design. We decided that this property is not needed since you can easily acquire the index of the selected item by reading the value of the SelectedItem property and call IndexOf for this item on the source collection.
Could you please give us some further details about your scenario and why would you need to have this property?
Thanks for your time.
Best wishes,
Deyan
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
prog1
Top achievements
Rank 1
answered on 20 Jun 2011, 10:13 AM
Hi Deyan,
event thought of using the RadDataBoundListbox the way you have described but there is one case which will not fit.
Scenario:
A list of strings, where item[0] means not set. String for that is "Not set" meaning string.Empty.
If there is a similar string, which really meant to be "Not set" you will have a problem, because the is no difference between the two objects.
You could easily make some real objects out of that strings, but that would be more work to be done.
Kind regards
Fabian
event thought of using the RadDataBoundListbox the way you have described but there is one case which will not fit.
Scenario:
A list of strings, where item[0] means not set. String for that is "Not set" meaning string.Empty.
If there is a similar string, which really meant to be "Not set" you will have a problem, because the is no difference between the two objects.
You could easily make some real objects out of that strings, but that would be more work to be done.
Kind regards
Fabian
0
Accepted
Hello Fabian,
Thanks for writing.
I am not quite sure that I correctly understand your scenario. Do you mean that you have two strings "Not set" in your collection? If this is the case, this will not work either way - with or without SelectedIndex - since both strings will always be equal and thus the selection mechanism would not differentiate between them.
Basically, if we add a SelectedIndex property it will be automatically initialized with the index of the currently
selected item. Therefore, if the selection is not correctly working due to the fact that there are equal items in the source collection, this property will not return the correct selection index as well.
To solve this case you should simply add a collection of some kind of simple business objects and display a given property exposed on them which might or might not have the same value on different objects. The selection mechanism will differentiate between the different objects by their references.
I hope this helps.
Greetings,
Deyan
the Telerik team
Thanks for writing.
I am not quite sure that I correctly understand your scenario. Do you mean that you have two strings "Not set" in your collection? If this is the case, this will not work either way - with or without SelectedIndex - since both strings will always be equal and thus the selection mechanism would not differentiate between them.
Basically, if we add a SelectedIndex property it will be automatically initialized with the index of the currently
selected item. Therefore, if the selection is not correctly working due to the fact that there are equal items in the source collection, this property will not return the correct selection index as well.
To solve this case you should simply add a collection of some kind of simple business objects and display a given property exposed on them which might or might not have the same value on different objects. The selection mechanism will differentiate between the different objects by their references.
I hope this helps.
Greetings,
Deyan
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>