两个Dropdownlist,第一个Dropdownlist有内容张三,李四,王五,对应的第2个Dropdownlist的内容有学号1,学号2,学号3,当Dropdownlist1内容为张三时,Dropdownlist2内容为学号1,当Dropdownlist1内容为李四时,Dropdownlist2内容为学号2,以此类推跪求代码

解决方案 »

  1.   

    感觉这个东西用ajax做比较好,而且也有changedIndex之类的事件,没有必要用到委托。楼主是不是想复杂了。
      

  2.   

    js
    ajax足够了
    还要用牛刀
      

  3.   

    向你这种情况,可以直接用DropDownList的SelectedIndexChanged事件,把放张三李四的DropDownList中AutoPostBack属性设为true就可以实现了。
      

  4.   

    dropdownlist联动
    <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <div>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
      <asp:DropDownList ID="ddlLB" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddlLB_SelectedIndexChanged">
      </asp:DropDownList>
      <asp:DropDownList ID="ddlChild" runat="server" Width="20%">
      </asp:DropDownList>
      </ContentTemplate>
      </asp:UpdatePanel>
      </div>  
    protected void ddlLB_SelectedIndexChanged(object sender, EventArgs e)
      {
      if(this.ddlLB.SelectedValue!=null)
      {  }
      }
      

  5.   

    不刷新:
    1.如果是.NET FrameWork 2.0以上的专案,直接使用UpdatePanel,最简便
    2.如果熟习JQuery,可以用JQuery写,也很简单刷新页面:
    直接设置dropdownlist的autopostback = true,后台直接写逻辑即可