Hi,
I am doing a mobile application. Someone else is passing me the datatable via a webservice so I get in the following:
DataTable dt = new DataTable(); // create a datatable dt
System.Guid guidCustomer = new Guid(Common.sCustomerID); // pass the guid
dt = ws.BoningRoomOrdersCustomerOrderItems(guidCustomer); // send guid to webservice
foreach (DataRow dr in dt.Rows)
{
ListViewItem lvi = new ListViewItem(dr["ProductName"].ToString());
lvi.SubItems.Add(dr["QuantityOrdered"].ToString());
lvi.SubItems.Add("0");
lvProductsOrdered.Items.Insert(0, lvi);
lvi.Tag = dr;
}
No problems - loads a listview with the product number and quantity required and in the lvi.Tag I put in the dr (DataRow)
Now my problem is later when someone taps on the listview item I now want to read the lvi.Tag and split it into the 4 parts
How the hell do I do this?
private void lvProductsOrdered_SelectedIndexChanged(object sender, EventArgs e)
{
if (lvProductsOrdered.SelectedIndices.Count == 1)
{
ListViewItem lvi = lvProductsOrdered.Items[lvProductsOrdered.SelectedIndices[0]];
if (lvi.Tag is DataRow)
{
any ideas?
part 1 is a guid
part 2 is an int
part 3 is another guid
part 4 is a string
thanks for your help