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

C# - Retrieve data from listview subitems

8 Answers 226 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 08 Nov 2011, 10:30 AM
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?

8 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 11 Nov 2011, 09:08 AM
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.

0
HarisB
Top achievements
Rank 1
answered on 10 Jun 2018, 10:39 AM

Hi,

How i update row/cell value in radlistview ?

br,

Džemal

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Jun 2018, 05:54 AM
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.
0
HarisB
Top achievements
Rank 1
answered on 13 Jun 2018, 06:37 AM

Hello,

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

Thank you,

Džemal

0
HarisB
Top achievements
Rank 1
answered on 13 Jun 2018, 06:41 AM

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

Best regards,

Džemal 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Jun 2018, 10:08 AM
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.
0
HarisB
Top achievements
Rank 1
answered on 13 Jun 2018, 11:06 AM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Jun 2018, 09:58 AM
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.
Tags
ListView
Asked by
Adam
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
HarisB
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or