如何在不刷新整个页面的情况下更新gridview的内容?

时间:2017-06-19 12:58:42

标签: asp.net

这是我的asp.net代码,我也在.cs代码中创建了计时器刻度事件 我在每个刻度线上绑定网格。我不想刷新页面我只想更新网格数据。怎么能做到这一点?

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <script type="text/javascript">
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_beginRequest(beginRequest);
            function beginRequest() {
                prm._scrollPosition = null;
            }
        </script>

        <asp:UpdatePanel ID="upBody" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled">
            <ContentTemplate>
                <div class="box box-primary" runat="server" id="GrdSummaryBox" visible="true">
                        <div class="row" id="grdClientSummaryRow" runat="server" visible="true">
                            <div class="col-md-12">
                                <div class="scroll" style="overflow: scroll; height: auto; width:auto">
                                        <asp:GridView ID="Grid1" runat="server" Visible="true" Width="100%" EnableViewState="false" AutoGenerateColumns="true">
                                    </asp:GridView>
                                </div>
                            </div>
                        </div>
                    </div>
                <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="1000"></asp:Timer>
            </ContentTemplate>
        </asp:UpdatePanel>

    </form>

0 个答案:

没有答案