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

Row number in DataBoundListBox item

1 Answer 45 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.
Morten
Top achievements
Rank 1
Morten asked on 17 Jan 2012, 07:15 PM
Hi,
I am looking for a way to extract the row number of a DataBoundListBox item. Is this possible?

Thanks.
Morten

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 18 Jan 2012, 01:16 PM
Hi Morten,

Thank you for your writing,

The rows in the RadDataBoundListBox are its items, and if I understand right, you need to get the index of a specific item in the source collection of the list box. If that is the case, then you can just use the IndexOf method of your collection and pass the required data item, which is actually the Content property of the associated ListBoxItem, as a parameter:

object dataItem = myListBoxItem.Content;
int index = mySourceCollection.IndexOf(dataItem);


I hope this helps. If this is not your case, don't hesitate to write us back.

Kind regards,
Todor
the Telerik team

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

Tags
DataBoundListBox
Asked by
Morten
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or