I am web developer , working on a part of my project developed in WinForms. So my question could be a basic one. Try to bear with it.
I have two list views on my page and a remove button that works for both.
Problems.
- I am not able to select a row in both the list view when I run my program, may be some property needed for it?
- If I am able to select the row I want to detect which list view item has been selected, so how would I do that?
I have three columns and have bound the data by using the code below.
listView1.Columns.Add("ID",20); listView1.Columns.Add("Name",40); listView1.Columns.Add("Mobile",40); foreach (var item in dataList) { newItem = new ListViewItem(); newItem.SubItems.Add(item.ID.ToString()); newItem.SubItems.Add(item.Name); newItem.SubItems.Add(item.Mobile.ToString()); listView1.Items.Add(newItem); }
but the ID
column is left blank and the data starts to bind in these sense.
ID Name Mobile
1 abc
2 xyz
So how do I properly show the data?
- Lastly I want to use my
ID
column to delete the data. So if I givewidth=0
, is this the best way to hide a column?