简体   繁体   中英

UpdateProgress is not displayed on partial postback

i have some time consuming serverside function so i try to execute each function step by step and inform the user about the progress.

So my approach was:

  • create a visible button that performs an asynchronous postback and handle the click event on serverside
  • execute the first function
  • update a Label to inform the user if the function was executed successfully
  • register a javascript that triggers the click-event of a second invisible( Style="display: none" ) button that is also registered as asynchronous trigger for the UpdatePanel
  • send page back to client and execute script to click the invisible button
  • handle the button-click, inform user, register js for third invisible button, execute button-click and so on...

But the problem is that the UpdateProgress-control will not be shown although i've set the AssociatedUpdatePanelID correctly. The functions are all triggered correctly and the labels are getting updated, only the UpdateProgress keeps invisible.

Have a look please:

<asp:UpdateProgress ID="UpdateProgress1" DynamicLayout="true" runat="server" AssociatedUpdatePanelID="UpdFormPanel" DisplayAfter="0">
    <ProgressTemplate>
        <div class="progress">
            <asp:Image ID="ImgProgress" runat="server" ImageUrl="~/images/ajax-loader-arrows.gif"
                ToolTip="loading..." />&nbsp;please wait...
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdFormPanel" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false">
    <ContentTemplate>
      ....
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnShowUploadResult" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="btnExtractFile" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="btnShowResultView" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<asp:Button ID="btnShowUploadResult" runat="server" CausesValidation="false" Text="hidden" Style="display: none" />
<asp:Button ID="btnExtractFile" runat="server" CausesValidation="false" Text="hidden" Style="display: none" />
<asp:Button ID="btnShowResultView" runat="server" CausesValidation="false" Text="hidden" Style="display: none" />

On this way i'm registering the javascript in the button-click event-handler:

AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(Me.UpdFormPanel, GetType(String), "ShowResultView", "$get('" & Me.btnShowResultView.ClientID & "').click();", True)

Thank you in advance.

Are you setting the enabled or visible properties in the code behind anywhere? This could cause the page not to render the control. HAve you verified that the html is there? Are you sure you're correctly changing the style when you need to? Use firebug and set break points. Walk through the js.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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