点击 button 重新从数据库取值赋给 updatepanl 里的 dropdownlist

解决方案 »

  1.   

    在button1_click()中,从数据库中获得数据
    DropDownLis1.Items.Clear();
    DropDownListTeam.DataSource = 获得的数据;
    //DropDownListTeam.DataValueField = "Name";
    //DropDownListTeam.DataTextField = "Name";
    DropDownListTeam.DataBind();
      

  2.   

    我也这样但是
    updatepanl 里的 dropdownlist否不刷新
      

  3.   

    怎么使用的
       <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        <div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                   <asp:DropDownList ID="ddl" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddl_SelectedIndexChanged">
                   </asp:DropDownList>
                     </ContentTemplate>
            </asp:UpdatePanel>
            </div> 
    还可
    <asp:DropDownList ID="ddl" runat="server" Width="150px" onchange="ddlChange(this);">
    </asp:DropDownList>  
      

  4.   

    button1_click()中,从数据库中获得数据DropDownListTeam.DataSource = 获得的数据;
    DropDownListTeam.DataValueField = "值字段";
    DropDownListTeam.DataTextField = "显示字段";
    DropDownListTeam.DataBind();
      

  5.   

     <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <div>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
      <asp:DropDownList ID="ddl" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddl_SelectedIndexChanged">
      </asp:DropDownList>
      </ContentTemplate>
      </asp:UpdatePanel>
      </div> 
    点击button 后重新给dropdownlist 赋值就不行了
    button 在UpdatePane外
      

  6.   

    button 在UpdatePane外
    定义UpdatePanel的异步刷新触发器为button的单击事件,这样就ok了
      

  7.   

    button 在UpdatePane外
    定义UpdatePanel的异步刷新触发器为button的单击事件
    但是dropdownlist不能重新取值,不知怎么搞的
      

  8.   

    <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:DropDownList ID="ddl" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddl_SelectedIndexChanged">
                        </asp:DropDownList>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnSub" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                <asp:Button ID="btnSub" runat="server" OnClick="btnSub_Click" />
            </div>正解!!!
      

  9.   

    检查dropdownlist的属性Autopostback值是否为true,不知道这样行不行,楼主试试吧!我也是新手!
      

  10.   

    <asp:AsyncPostBackTrigger ControlID="btnSub" EventName="Click" />
    这个也用了但就刷新不了,救急