后台自动添加的服务器控件以及其相应的事件,该事件无法进入、求解决
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);
}