Row number in DataBoundListBox item

2 posts, 0 answers
  1. Morten
    Morten avatar
    3 posts
    Member since:
    Dec 2008

    Posted 17 Jan 2012 Link to this post

    Hi,
    I am looking for a way to extract the row number of a DataBoundListBox item. Is this possible?

    Thanks.
    Morten
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 18 Jan 2012 Link to this post

    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 >>

  3. DevCraft banner
Back to Top