protected void gvUserInfo_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == DataControlRowType.DataRow)//error { con.Open(); DropDownList ddl = (DropDownList)e.Item.FindControl("ddsponcor"); SqlCommand cmd = new SqlCommand("select sponcorid from Registration_Master", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); con.Close(); ddl.DataSource = ds; ddl.DataTextField = "sponcorid"; ddl.DataValueField = "sponcorid"; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("--Select--", "0")); } }
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { }
foreach (ListItem li in ListBox1.Items) { DropDownList1.Items.Add(li); }
if (TypeOf(e.Item) == DataControlRowType.DataRow)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)