开发者

UpdateProgress is not displayed on partial postback

开发者 https://www.devze.com 2023-02-09 01:39 出处:网络
i have some time consuming serverside function so i try to execute each function step by step and inform the user about the progress.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号