private void WriteListView() { App_Data.POSDataSet.UsersDataTable objDT = new App_Data.POSDataSet.UsersDataTable(); myUserAd.FillUsersBy(objDT); cmbIDs.Items.Clear(); listView1.Items.Clear(); cmbIDs.Items.Clear(); string[] str = new string[objDT.Columns.Count]; string type = ""; //adding Datarows as listview Grids foreach (DataRow objRR in objDT.Rows) { for (int col = 0; col <= objDT.Columns.Count - 1; col++) { if (col == 0) { cmbIDs.Items.Add(objRR[col].ToString()); continue; } if (col == 3) { if (objRR[3].ToString() == "1") { type = "Regular"; str[2] = type; } else if (objRR[3].ToString() == "2") { type = "Moderator"; str[2] = type; } continue; } str[col - 1] = objRR[col].ToString(); } ListViewItem ii; ii = new ListViewItem(str); listView1.Items.Add(ii); } }
private void WriteListView() { App_Data.POSDataSet.UsersDataTable objDT = new App_Data.POSDataSet.UsersDataTable(); myUserAd.FillUsersBy(objDT); cmbIDs.Items.Clear(); listView1.Items.Clear(); cmbIDs.Items.Clear(); string[] str = new string[objDT.Columns.Count]; string type = ""; //adding Datarows as listview Grids foreach (DataRow objRR in objDT.Rows) { for (int col = 0; col <= objDT.Columns.Count - 1; col++) { if (col == 0) { cmbIDs.Items.Add(objRR[col].ToString()); continue; } if (col == 3) { if (objRR[3].ToString() == "1") { type = "Regular"; str[2] = type; } else if (objRR[3].ToString() == "2") { type = "Moderator"; str[2] = type; } continue; } str[col - 1] = objRR[col].ToString(); } ListViewItem ii; ii = new ListViewItem(str); listView1.Items.Add(ii); } }