zoukankan      html  css  js  c++  java
  • UpdatePanel局部刷新

    前台代码:注意ScriptManager,和UpdatePanel是配套使用的。在ContentTemplate中写局部刷新内容

     <asp:ScriptManager ID="ScriptManager1" runat="server">
                                        </asp:ScriptManager>
                                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                            <ContentTemplate>
                                                <%-- <select id="selectGame" style=" 150px;" onchange="Server_Data()">
                                        </select>--%>
                                                <table>
                                                    <tr>
                                                        <td style="padding-left: 0PX">
                                                            <asp:DropDownList ID="ddlGame" runat="server" Width="150px" AutoPostBack="True" OnSelectedIndexChanged="ddlGame_SelectedIndexChanged">
                                                            </asp:DropDownList>
                                                        </td>
                                                        <td>
                                                            充值服务区:
                                                        </td>
                                                        <td style="padding-left: 27PX">
                                                            <asp:DropDownList ID="ddlServer" runat="server" Width="150px">
                                                                <asp:ListItem>请选择</asp:ListItem>
                                                            </asp:DropDownList>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>

    后台:ScriptManager.RegisterStartupScript这个是调用前台JS的方法。

            protected void ddlGame_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (ddlGame.SelectedIndex != 0 && Request["dept"] != null)
                {
                    string deptID = Request["dept"];
                    string whereStr = " game_id='" + ddlGame.SelectedValue + "' and plat='" + new OA.Count.Model.PlatType().GetTable(" deptID=" + deptID).Rows[0]["name"] + "'";
                    Common.AspNetControl.BindDropDownList(ddlServer, new Game.Model.ServerInfo().GetTable(whereStr));
    
                }
                else
                {
                    ddlServer.Items.Clear();
                    ddlServer.Items.Add("请选择");
                }
    
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "updatePanel1show", "change_css()", true);
            }
  • 相关阅读:
    检测是否安装了新包
    redux和mobx的比较
    ssh登录远程服务器
    法律
    如何解决二方包彼此依赖?
    创业
    【转】裸辞4个月,面试30家公司。
    添加群机器人
    RESTful状态码说明
    MongoDB简单介绍以及基本命令
  • 原文地址:https://www.cnblogs.com/zgaspnet/p/2950183.html
Copyright © 2011-2022 走看看