Simple loop to retrieve sub-items in ListView

2 posts, 1 answers
  1. Martin
    Martin avatar
    35 posts
    Member since:
    Jun 2014

    Posted 17 Apr 2015 Link to this post

    Hi folks.

    I have a list view which can be populated with many rows of data (not databound)

    Once populated I want to grab the text values of certain sub items - but the ListViewDataItem does not have a subitem property


    foreach (ListViewDataItem item in radListViewPOItem.Items)


    Any tips on how to accomplish a simple task?



  2. Answer
    Ralitsa avatar
    175 posts

    Posted 21 Apr 2015 Link to this post

    Hi Martin,

    Thank you for contacting us. 

    I suppose that you use the ListViewType.DetailsView and want to get the value of specific column. Here is the code snippet: 
    foreach (ListViewDataItem item in this.radListView2.Items)
        if (item["Column1"].ToString() == "CellValue1 3")
            this.radLabel2.Text = "Text: " + item.Text + "\nValue " + item.Value;

    In the attachment you can find a sample demo. 

    If this is not what you want to achieve, I would kindly ask you to send me a more detailed explanation how you add the list items and which text you want to get. 

    Let me know if I can assist you further.


    See What's Next in App Development. Register for TelerikNEXT.

  3. DevCraft R3 2016 release webinar banner
Back to Top