I am trying to use UpdateProgress
with a GridView
. What I expect to see is a "Loading..." message when the report buttons are pressed on the GridView
and the message disappear after the button's action (i.e., return a report) is finished. I tried two different approaches:
Approach 1 (AsyncPostBackTrigger):
<asp:UpdateProgress ID="PageUpdateProgress" runat="server" AssociatedUpdatePanelID="Panel">
<ProgressTemplate>
Loading...
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="Panel" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gridRight" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="Report_Key" DataSourceID="dsReports"
PageSize="150" OnRowCommand="gridRight_RowCommand" >
<Columns>
<asp:BoundField DataField="Report_Key" HeaderText="Report #" />
<asp:BoundField DataField="Report_Name" HeaderText="Report Name" />
<asp:ButtonField CommandName="GETREPORT" Text="Get Report">
<ItemStyle ForeColor="Blue" Width="40px" />
</asp:ButtonField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gridRight" EventName="RowCommand" />
</Triggers>
</asp:UpdatePanel>
Result 1: UpdatePanel content is not displayed, button seemed like it did not generate a post back and I got a JavaScript error: Error: Unable to get property 'PRM_ParserErrorDetails' of undefined or null reference. After removing the <Triggers> block, the result did not change.
Approach 2 (PostBackTrigger):
<asp:UpdateProgress ID="PageUpdateProgress" runat="server" AssociatedUpdatePanelID="Panel">
<ProgressTemplate>
Loading...
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="Panel" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gridRight" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="Report_Key" DataSourceID="dsReports"
PageSize="150" OnRowCommand="gridRight_RowCommand" >
<Columns>
<asp:BoundField DataField="Report_Key" HeaderText="Report #" />
<asp:BoundField DataField="Report_Name" HeaderText="Report Name" />
<asp:ButtonField CommandName="GETREPORT" Text="Get Report">
<ItemStyle ForeColor="Blue" Width="40px" />
</asp:ButtonField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="gridRight" />
</Triggers>
</asp:UpdatePanel>
Result 2: Buttons worked as expected, no JavaScript error occurred, but UpdateProgress content did not show up.
What do you think I am doing wrong?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…