玄铁剑

成功的途径:抄,创造,研究,发明...
posts - 128, comments - 42, trackbacks - 0, articles - 174

Ajax Progress

Posted on 2008-02-28 21:58 玄铁剑 阅读(360) 评论(0)  编辑 收藏 引用 所属分类: asp.netAjax

.ShowProgress
{
    display: block;
    position: absolute;
    padding: 2px 3px;
}
.Processcontainer
{
    border: solid 1px #808080;
    border-width: 1px 0px;
}
.Processheader
{
    background: url(images/sprite.png) repeat-x 0px 0px;
    border-color: #808080 #808080 #ccc;
    border-style: solid;
    border-width: 0px 1px 1px;
    padding: 0px 10px;
    color: #000000;
    font-size: 9pt;
    font-weight: bold;
    line-height: 1.9; 
    font-family: arial,helvetica,clean,sans-serif;
}
.Processbody
{
    background-color: #f2f2f2;
    border-color: #808080;
    border-style: solid;
    border-width: 0px 1px;
    padding: 10px;
}

<script type="text/javascript">
    // get the id of the control which caused the postback
    var postBackElementID;
    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(InitializeRequestHandler);
    function InitializeRequestHandler(sender, args)
    {
       postBackElementID = args.get_postBackElement().id.substring(args.get_postBackElement().id.lastIndexOf('_') + 1); 
       MyOnUpdating();
    } 

    function MyOnUpdating()
    {
        //if (postBackElementID == 'btnGoBack')    
       
        // get the update progress div
        var pnlPopup = $get('<%= this.pnlPopup.ClientID %>');

        // make it visible
        pnlPopup.style.display = '';    
       
        // get the bounds of both the gridview and the progress div
        var pnlPopupBounds = Sys.UI.DomElement.getBounds(pnlPopup);

        //  center of center
        var x = Math.round(window.screen.width / 2) - Math.round(pnlPopupBounds.width / 2);
        var y = Math.round(window.screen.height / 2)-200;

        // set the progress element to this position
        Sys.UI.DomElement.setLocation(pnlPopup, x, y);          
    }   
</script>

<asp:Panel ID="pnlPopup" runat="server" CssClass="ShowProgress" Style="display: none;">
    <div class="Processcontainer">
        <div class="Processheader">
            <asp:Label ID="LblProcess" runat="server" Text="數據加載處理中,請稍後..."></asp:Label>
        </div>
        <div class="Processbody">
            <asp:Image ID="ImgProcess" runat="server"  ImageUrl="~/App_Themes/Default/images/activity.gif" />
        </div>
    </div>
</asp:Panel>

只有注册用户登录后才能发表评论。