C# - Retrieve data from listview subitems

9 posts, 0 answers
  1. Adam
    Adam avatar
    1 posts
    Member since:
    Nov 2011

    Posted 08 Nov 2011 Link to this post

    Hi,

    I am trying to retrieve the data that is in a listviews subitems.

    I would have thought something like this would be the answer, but I cant find anything similar to it.

     var test = radListView1.Items[2].SubItems[2].Value

    Where am I going wrong?
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 11 Nov 2011 Link to this post

    Hello Adam,

    Thank you for your question.

    You can find the answer to your question in this help article, under the section 'Populating cells'.

    I hope you find it useful. Feel free to ask if you have any additional questions.

    Best wishes,
    Ivan Todorov
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  3. HarisB
    HarisB avatar
    9 posts
    Member since:
    Sep 2016

    Posted 10 Jun 2018 in reply to Ivan Todorov Link to this post

    Hi,

    How i update row/cell value in radlistview ?

    br,

    Džemal

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3568 posts

    Posted 11 Jun 2018 Link to this post

    Hello, Džemal,  

    If your RadListView is in bound mode, you can directly update the DataBoundItem. However, if you use unbound mode, you can access the desired cell. You can set cell values to the items of RadListView using their indexers. The keys can be either the index of the column, the name of the column, or the column itself. Please refer to the following help article: https://docs.telerik.com/devtools/winforms/listview/populating-with-data/unbound-mode

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. HarisB
    HarisB avatar
    9 posts
    Member since:
    Sep 2016

    Posted 13 Jun 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello,

    How can I control duplicate item on radlistview1 ? How can I find item by text ?

    Thank you,

    Džemal

  6. HarisB
    HarisB avatar
    9 posts
    Member since:
    Sep 2016

    Posted 13 Jun 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    I'm talking about Windows form. Otherwise, very little documentation for radlistview control.

    Best regards,

    Džemal 

  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3568 posts

    Posted 13 Jun 2018 Link to this post

    Hello, Džemal,  

    In order to find a specific item by text, you can iterate the Items collection and check which item's text meets the search criteria. As to the documentation, we strive to cover the common features that the RadListView supports and the public API it exposes. Any feedback about what should be included in the documentation as well will be greatly appreciated.

    ListViewDataItem searchResult = null;
    foreach (ListViewDataItem item in this.radListView1.Items)
    {
        if (item.Text == "Ikura")
        {
            searchResult = item;
            break;
        }
    }

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  8. HarisB
    HarisB avatar
    9 posts
    Member since:
    Sep 2016

    Posted 13 Jun 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello,

    Thank you.

    I worked on default lists:

    foreach (ListViewItem item in listView1.Items)

    {

    var invoice = item.SubItems[1];

    if (invoice.Text == "whatever")

    {

    item.SubItems[2] = new ListViewItem.ListViewSubItem()

    {

    Text = "Paid"

    };

    break;

    }

    }

    how do I update on the list as on the line:

    item.SubItems[2] = new ListViewItem.ListViewSubItem()
    {
    Text = "Paid"
    };

    Best regards,

    Džemal

  9. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3568 posts

    Posted 14 Jun 2018 Link to this post

    Hello, Džemal,  

    According to the attached screenshot it seems that you use Details View in RadListView. The following help article demonstrates how to add columns and specify the cells' values: https://docs.telerik.com/devtools/winforms/listview/populating-with-data/unbound-mode 

    You can set cell values to the items of RadListView using their indexers. The keys can be either the index of the column, the name of the column, or the column itself.

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top