I don't know how to get data from each column in RadListView. How to get data from first column? Thanks for reading!
1 Answer, 1 is accepted
1
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 06 Aug 2021, 02:38 PM
Hello, Hoang,
RadListView in DetailsView provides a grid-like interface for displaying items. If you want to get the cell values from the first column you can use the following code snippet:
I have another question that I hope you can answer. How to bulk delete items containing certain characters in ListView?
Here is my code:
foreach( var item in radListView1.Items)
{
if (item[1].ToString() == "Gas")
radListView1.Items.Remove(item);
}
Get Error message: Collection was modified; enumeration operation may not execute.
Dess | Tech Support Engineer, Principal
Telerik team
commented on 09 Aug 2021, 01:13 PM
Hello, Hoang,
You can get 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. In the previous code snippet, provided by Nadya, item[0] means that the cell's value of the very first column will be extracted. Changing the index from 0 to 1 and so on, you will get the value of the next column. The following article demonstrates how to add columns to RadListView and specify values to these cells. In a similar way you can extract the cell's value: https://docs.telerik.com/devtools/winforms/controls/listview/populating-with-data/unbound-mode#adding-columns