protected void AddDropList(int pid, int i)
{
DataTable dt = gbll.GetList("ParentID=" + pid).Tables[0];
if (dt.Rows.Count > 0)
{
DropDownList drp = new DropDownList();
drp.ID = "drpGroup" + i;
drp.AutoPostBack = true;
drp.SelectedIndexChanged += new EventHandler(drp_SelectedIndexChanged); drp.DataSource = dt;
drp.DataTextField = "GrpName";
drp.DataValueField = "ID"; drp.DataBind();
tbProduct.Rows[0].Cells[1].Controls.Add(drp); AddDropList(Convert.ToInt32(dt.Rows[0]["ID"]), i + 1);
} } public void drp_SelectedIndexChanged(object sender, EventArgs e)
{
int id = Convert.ToInt32(drpGroup1.SelectedValue);
int classnum = GetClassNum(id, 2);
DropDownList drp = Page.FindControl("drpGroup" + classnum) as DropDownList;
AddDropList(id, classnum);
}
{
DataTable dt = gbll.GetList("ParentID=" + pid).Tables[0];
if (dt.Rows.Count > 0)
{
DropDownList drp = new DropDownList();
drp.ID = "drpGroup" + i;
drp.AutoPostBack = true;
drp.SelectedIndexChanged += new EventHandler(drp_SelectedIndexChanged); drp.DataSource = dt;
drp.DataTextField = "GrpName";
drp.DataValueField = "ID"; drp.DataBind();
tbProduct.Rows[0].Cells[1].Controls.Add(drp); AddDropList(Convert.ToInt32(dt.Rows[0]["ID"]), i + 1);
} } public void drp_SelectedIndexChanged(object sender, EventArgs e)
{
int id = Convert.ToInt32(drpGroup1.SelectedValue);
int classnum = GetClassNum(id, 2);
DropDownList drp = Page.FindControl("drpGroup" + classnum) as DropDownList;
AddDropList(id, classnum);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货