I have a Listview named "listview1". I am displaying students name in the list view.
I got collection of students Id and name in a data table.
// appending the students name in the listview
foreach (DataRow dr in dtStudentInfo.Rows)
{
Item = listView1.Items.Add(dr["strName"].ToString());
Item.Tag = dr["nId"].ToString();
}
question : How can i get name of the student if i know the student Id?
Eg: For the student Id 5 i want to know the name of the student.
Here i can do this by getting whole item collection inside a for loop and
i can compare the tag. But i want a direct method where i can specify the tag as 5 and get
student name for the respective tag?
Loading
subrahmanyaPosted Aug 14, 2012, 3:04 AM
listView1.Items.Add("key", "Text", 0);
......................
.....................
listView1.Items.Find("key", true) returns array of items
sarin sPosted Aug 14, 2012, 6:24 AM