简体   繁体   English

UpdatePanel外部的Gridview不显示

[英]Gridview outside UpdatePanel not showing

I have an ItemCommand event in a button found in a listview. 我在列表视图的按钮中有一个ItemCommand事件。

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
    <asp:ListView ID="systemsView" runat="server" 
        onitemcommand="systemsView_ItemCommand">
        <ItemTemplate>
            <asp:Button ID="btnView" runat="server" Text='<%#Eval("SYSTEM_DESC") %>' CommandArgument='<%# Eval("ROW_ID")%>'
                class="systemButtonStyle" />
        </ItemTemplate>
    </asp:ListView>
</ContentTemplate>                        
</asp:UpdatePanel>

When the itemCommand is fired I want to bind another gridview which is not inside the update panel. 触发itemCommand时,我想绑定另一个不在更新面板内的gridview。 The gridview is not showing when the event is fired. 事件触发时,gridview不会显示。 Any ideas how I could solve this problem please? 有什么想法可以解决这个问题吗?

Since UpdatePanel s only perform a PostBack on controls within their ContentTemplate , all controls that are expected to be updated by a Partial PostBack must be housed within the same UpdatePanel 's ContentTemplate. 由于UpdatePanel仅在其ContentTemplate控件上执行PostBack,因此必须由Partial PostBack更新的所有控件都必须位于同一UpdatePanel的ContentTemplate中。

If you need to update something outside of an UpdatePanel with an action that occurs within it's Partial PostBack, you will have to rethink your use of the UpdatePanel . 如果您需要使用部分回发中发生的操作来更新UpdatePanel之外的内容,则必须重新考虑对UpdatePanel的使用。

Two solutions: 两种解决方案:

  • Add the other GridView to the UpdatePanel 's ContentTemplate. 将另一个GridView添加到UpdatePanel的ContentTemplate中。

  • Remove the UpdatePanel entirely and use the normal PostBack. 完全删除UpdatePanel并使用常规的PostBack。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM