ListBox LstBox = (dgi.FindControl("lstType") as ListBox); string strselect = ""; for (int j = 0; j < LstBox.Items.Count; j++) { ListItem li = LstBox.Items[j]; if (li.Selected) { strselect = strselect + ", " + li.Value; } } if (strselect.Length > 0) { strselect = strselect.Remove(0, 2); } dr["Type"] = strselect;
DataTable dtData = new DataTable(); dtData.Columns.Add("Selected"); DataRow dr = dtData.NewRow(); dr["Selected] = ListBox1.Selectedvalue.ToString(); dtData.Rows.Add(dr); GridView1.DataSource = dtData.Copy(); GridView1.DataBind();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)