ltit 系信息   ldit  专业信息  cu是Repeaterprotected void cu_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        DropDownList ltit = e.Item.FindControl("ltit") as DropDownList;
        DropDownList ldit = e.Item.FindControl("ldit") as DropDownList;
        ltit.DataSource = tieManage.getAllTie(1);
        ltit.DataTextField = "tieName";
        ltit.DataValueField = "tieID";
        ltit.DataBind();
        ldit.DataSource = disciplineManage.getAllDps(int.Parse(stdc.Substring(0, a).ToString()));
        ldit.DataTextField = "disciplineName";
        ldit.DataValueField = "disciplineID";
        ldit.DataBind();
}
protected void ltit_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ltit = (DropDownList)sender;
        DropDownList ldit =     }
在ltit_SelectedIndexChanged函数里获取不到ldit的ID、、、只能够在Repeater里的事件写
这样两个DropDownList就实现不到联动了~、求高手指点

解决方案 »

  1.   

    还没试过放在Repeater里面
    关注中
      

  2.   

    OnSelectedIndexChanged="ltit_SelectedIndexChanged"
    protected void ltit_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl= sender as DropDownList;
            Repeater rpt = ddl.Parent.Parent as Repeater;
            int n = ((RepeaterItem)ddl.Parent).ItemIndex;
            DropDownList ddl2= rpt.Items[n].FindControl("ldit") as DropDownList ;
          }
      

  3.   

    楼上的可以写成这样
    DropDownList ddl=sender as DropDownList;
    RepeaterItem item=ddl.parent as RepeaterItem;
    DropDownList ddl2=item.findControl("") as DropDownList;