各位大虾,我在我的页面里放入了两个DropDownList,DropDownList1和DropDownList2,DropDownList2里的索引值会随着DropDownList1现实的值改变而改变(通过绑定数据源),但是运行时发现我选择DropDownList1的值的时候,DropDownList2的集合没有改变,因此我将这两个DropDownList放到了updatepanel里,但是问题依旧,于是我在cs文件里加入了事件发生器
    protected void DropDownList1_TextChanged(object sender, EventArgs e)
    {
        UpdatePanel3.Update();    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        UpdatePanel3.Update();
    }结果,无论我使用那个事件发生器,都不起作用,这是为什么呢,求解,
其实也不一定要用这种方法,有其他的方法能达到效果也行的,跪求帮助

解决方案 »

  1.   

    参考
    <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)
      {  }
      } 
      

  2.   

                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="DropDownList1_SelectedIndexChanged">