简体   繁体   English

ASP.NET在更新面板更新时显示“正在加载...”消息

[英]ASP.NET Display “Loading…” message while update panel is updating

Hello I am creating an ASP.NET/C# application I have an update panel that takes time to update. 您好我正在创建一个ASP.NET / C#应用程序我有一个需要时间更新的更新面板。 Is there a way to display a "Loading... Please Wait" Message during the time of the calculations? 有没有办法在计算期间显示“正在加载......请等待”消息?

Currently I am using AJAX panel animation fade in/fade out, to make the panel disappear while calculating and then reappear when done. 目前我正在使用AJAX面板动画淡入/淡出,使面板在计算时消失,然后在完成时重新出现。 But that is not very practical. 但这不太实际。

I need to display a message if possible. 如果可能,我需要显示一条消息。

Thank you for any help. 感谢您的任何帮助。

this is the code of my panel: 这是我的面板的代码:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click"/>
    </Triggers>
    <ContentTemplate>
        //Contents goes here
    </ContentTemplate>
</asp:UpdatePanel>

And the Ajax Panel animation extender 和Ajax Panel动画扩展器

<ajaxToolkit:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server" TargetControlID="UpdatePanel1">
    <Animations>
        <OnUpdating>
            <FadeOut Duration="1" Fps="20" />
        </OnUpdating>
        <OnUpdated>
            <FadeIn Duration="2" Fps="20" />
        </OnUpdated>
    </Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>

You can use code as below when 您可以使用以下代码

using Image as Loading 使用图像作为加载

<asp:UpdateProgress id="updateProgress" runat="server">
    <ProgressTemplate>
        <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/ajax-loader.gif" AlternateText="Loading ..." ToolTip="Loading ..." style="padding: 10px;position:fixed;top:45%;left:50%;" />
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>

using Text as Loading 使用文本作为加载

<asp:UpdateProgress id="updateProgress" runat="server">
    <ProgressTemplate>
        <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
            <span style="border-width: 0px; position: fixed; padding: 50px; background-color: #FFFFFF; font-size: 36px; left: 40%; top: 40%;">Loading ...</span>
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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