简体   繁体   English

在页面中间显示Ajax UpdateProgress

[英]Display Ajax UpdateProgress in the middle of the Page

I am using the Ajax UpdateProgress control. 我正在使用Ajax UpdateProgress控件。 Though it is working just as I expected it to work, I want it to appear at the center of the page. 尽管它能按我预期的那样工作,但我希望它显示在页面的中心。 How do I do that 我怎么做

<asp:UpdateProgress runat="server"
      id="PageUpdateProgress" DisplayAfter=0
      DynamicLayout=true>
   <ProgressTemplate>
      <div>
         <img src="../Images/load.gif" />           
     </div>
   </ProgressTemplate>
</asp:UpdateProgress>

Thanks Jaidev, Very handy post! 感谢Jaidev,非常方便的帖子!

It can take a while to get the css just right, so just to simplify the solution for everyone else, you only need the following (for updateprogress middle-positioning): 为了使CSS正确,可能需要花费一些时间,因此为了简化其他所有人的解决方案,您只需要以下内容(对于updateprogress中间位置):

<div style="position:absolute; width:100%;height:100%;"></div>

and for the image: 对于图像:

<img style="position:relative; top:45%;" />

use this style in your div: 在div中使用以下样式:

style="position:absolute;visibility:visible;border:none;z-index:100;width:100%;height:100%;background:#999;filter: alpha(opacity=80);-moz-opacity:.8; opacity:.8;"

and use this style in your img: 并在您的img中使用此样式:

style="top:48%; left:42%; position:relative;"

Try this: 尝试这个:

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate >
        <div id="dvProgress" runat="server" style="position:absolute; top: 300px;
                                                   left: 550px; text-align:center;">
            <asp:Image ID="Image2" runat="server" Height="46px" Width="47px" 
                       ImageUrl="~/App_Themes/Default/Images/wait_ax.gif"  />
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>

Set your CSS properties as percentages. 将CSS属性设置为百分比。

In the second div: 在第二个div中:

  1. Set background-image: url('[Path to your image]'). 设置背景图像:url('[图像的路径]')。
  2. Set top, left, height, width accordingly; 相应地设置顶部,左侧,高度,宽度; top = (100-height)/2, left = (100-width)/2 顶部=(100高度)/ 2,左侧=(100宽度)/ 2

In both divs, check the z-index is set above other content. 在两个div中,检查z索引是否设置在其他内容之上。

Works in IE... 在IE中运作...

<asp:UpdateProgress ID="updateProgress" runat="server" DynamicLayout="true">
    <ProgressTemplate>

            <div style="position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; overflow: hidden; padding: 0; margin: 0; background-color: #F0F0F0; filter: alpha(opacity=50); opacity: 0.5; z-index: 100000;"></div>

            <div style="position: fixed; top: 40%; left: 40%; height:20%; width:20%; z-index: 100001;  background-color: #FFFFFF; border:2px solid #000000; background-image: url('../../Images/ajax-loader-big.gif'); background-repeat: no-repeat; background-position:center;"></div>

        </ProgressTemplate>
</asp:UpdateProgress>

I used in my project this code. 我在项目中使用了此代码。

The ASPX : ASPX:

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="100" DynamicLayout="true" >
  <ProgressTemplate>
    <div class="update">
    </div>
  </ProgressTemplate>
</asp:UpdateProgress>

The CSS : CSS:

/* UPDATEPANEL PROGRESS : masque lors du chargement des résultats */
.update
{
position: fixed;
top: 0px;
left: 0px;
min-height: 100%;
min-width: 100%;
background-image: url("Images/Loading.gif");
background-position:center center;
background-repeat:no-repeat;
background-color: #e4e4e6;
z-index: 500 !important;
opacity: 0.8;
overflow: hidden;
}

Use ModalPpoupExtender and set the target control to the update progress 使用ModalPpoupExtender并将目标控件设置为更新进度

<cc1:ModalPopupExtender ID="ModalPopupExtender1" TargetControlID="PageUpdateProgress"
            PopupControlID="PageUpdateProgress" BackgroundCssClass="modalback" runat="server">
        </cc1:ModalPopupExtender>

您还可以使用UpdatePanelAnimationExtender和ig停用触发提交事件的控件。

I have tried this code and it works in IE and Chrome: 我已经尝试过此代码,并且可以在IE和Chrome中运行:

        <asp:UpdateProgress runat="server">
            <ProgressTemplate>
                <div class="Modal">
                    <img src="/img/load.gif" class="Loadin" />
                </div>
                <style>
                    .Modal {
                        position: fixed;
                        width: 100%;
                        height: 100%;
                        background-color: rgba(6, 0, 137, 0.40);
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                    }
                    .Loadin {
                        position: relative;
                        top: 50%;
                        right: 50%;
                    }
                </style>
            </ProgressTemplate>
        </asp:UpdateProgress>

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

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