protected void rptCustomers_ItemDataBound(object sender, RepeaterItemEventArgs e) { DropDownList drplist = e.Item.FindControl("drpList") as DropDownList; DropDownList drpSublist = e.Item.FindControl("drpSubcategory") as DropDownList; cmd.CommandType = CommandType.Text; con.Open(); SqlDataReader idr = cmd.ExecuteReader(); DataTable dtcat = new DataTable(); dtcat.Load(idr); if (dtcat.Rows.Count > 0) { drplist.DataSource = dtcat; drplist.DataValueField = "description"; drplist.DataTextField = "description"; drplist.DataBind(); idr.Close(); con.Close(); } SqlDataReader idr2 = cmd.ExecuteReader(); DataTable dtcat2 = new DataTable(); dtcat2.Load(idr2); if (dtcat.Rows.Count > 0) { drpSublist.DataSource = dtcat2; drpSublist.DataValueField = "description"; drpSublist.DataTextField = "description"; drpSublist.DataBind(); idr.Close(); con.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)