Question

I have an ItemCommand event in a button found in a listview.

    <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. The gridview is not showing when the event is fired. Any ideas how I could solve this problem please?

Was it helpful?

Solution

Since UpdatePanels 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.

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.

Two solutions:

  • Add the other GridView to the UpdatePanel's ContentTemplate.

  • Remove the UpdatePanel entirely and use the normal PostBack.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top