Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
682 views
in Technique[技术] by (71.8m points)

asp.net - UpdateProgress with GridView on row commands does not work (Unable to get property 'PRM_ParserErrorDetails')

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...