Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在UpdatePanel中更新GridView?_Gridview_Updatepanel - Fatal编程技术网

如何在UpdatePanel中更新GridView?

如何在UpdatePanel中更新GridView?,gridview,updatepanel,Gridview,Updatepanel,我有一个多页面的gridview,叫做gvChild,它位于UpdatePanel中 问题是当我从第1页转到第2页时,当我选择gvChild的一行时,值没有更新。实际上,我正在使用“行”在GridView中保存“存储”信息,当我单击其中一个“行”时,gvChild.SelectedDataKey将更新。但当我点击第二页的行时,选择了DataKey only'null',这有点棘手 因此,我正在考虑如何在gridview页面发生变化时更新我的UpdatePanel。我搜索了google,试图为我的

我有一个多页面的gridview,叫做gvChild,它位于UpdatePanel中

问题是当我从第1页转到第2页时,当我选择gvChild的一行时,值没有更新。实际上,我正在使用“行”在GridView中保存“存储”信息,当我单击其中一个“行”时,gvChild.SelectedDataKey将更新。但当我点击第二页的行时,选择了DataKey only'null',这有点棘手

因此,我正在考虑如何在gridview页面发生变化时更新我的UpdatePanel。我搜索了google,试图为我的gridview添加一个触发器--“gvChild”,并将EventName设置为“PageIndexChanging”,但它不起作用。非常感谢

<asp:UpdatePanel ID="upnlChild" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
    <ContentTemplate>
        <div>
            <div class="grid">
                <div class="rounded">

                    <div class="mid-outer">
                        <div class="mid-inner">
                            <div class="mid">
                                <asp:GridView SkinID="mastertable" ID="gvChild" runat="server" OnRowDataBound="gvChild_RowDataBound"
                                    OnRowCommand="gvChild_RowCommand" DataKeyNames="StoreID" OnSelectedIndexChanged="gvChild_SelectedIndexChanged"
                                    OnPageIndexChanging="gvChild_PageIndexChanging" OnSorting="gvChild_Sorting">
                                    <Columns>
                                        <asp:BoundField HeaderText="&nbsp;ID" DataField="StoreID" SortExpression="StoreID"
                                            ItemStyle-CssClass="first">
                                            <ItemStyle CssClass="first"></ItemStyle>
                                        </asp:BoundField>
                                        <asp:BoundField HeaderText="Store #" DataField="StoreNum" SortExpression="StoreNum" />

                                    </Columns>
                                    <PagerTemplate>
                                        <div class="pager">
                                            <asp:ImageButton CommandName="Page" SkinID="first" CommandArgument="first" ID="btnChild_First"
                                                runat="server" CausesValidation="false" />
                                            <asp:ImageButton CommandName="Page" SkinID="prev" CommandArgument="prev" ID="btnChild_Prev"
                                                runat="server" CausesValidation="false" />
                                            <asp:Label ID="lblPage" runat="server" Text="Page"></asp:Label>
                                            <asp:DropDownList ID="ddlChild_Pages" runat="server" OnSelectedIndexChanged="ddlChild_Pages_SelectedIndexChanged"
                                                AutoPostBack="True">
                                            </asp:DropDownList>
                                            <asp:Label ID="lblPageCount_Child" runat="server"></asp:Label>
                                            <asp:ImageButton CommandName="Page" SkinID="next" CommandArgument="next" ID="btnChild_Next"
                                                runat="server" CausesValidation="false" />
                                            <asp:ImageButton CommandName="Page" SkinID="last" CommandArgument="last" ID="btnChild_Last"
                                                runat="server" CausesValidation="false" /></div>
                                    </PagerTemplate>
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <asp:Button ID="btnChild_Add" runat="server" Text="Add Store" OnClick="btnChild_Add_Click"
            CausesValidation="false" />
    </ContentTemplate>

    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="gvChild" EventName="PageIndexChanging" />
    </Triggers>

</asp:UpdatePanel>


对不起,如果我太厚了,那么“当我选择gvChild的一行时,值没有更新”是什么意思呢?Zortkun,实际上我正在使用“行”将“存储”信息保存在GridView中,当我单击其中一行时,gvChild.SelectedDataKey将更新。但当我点击第二页的行时,选择了DataKey only'null',这有点棘手。。。