Click here to Skip to main content
15,902,022 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a webpage where i had put an update progress control.I want that as the update progress starts, the entire Page will be gray out and as it completes the page will resume to original.
Below is the code i had added for Update Progress:-

ASP.NET
<<pre lang="xml">div class="divTextAlign">
            <asp:Updateprogress id="updProgress" runat="server" dynamiclayout="true" associatedupdatepanelid="updForgotPassword">
                <Progresstemplate>
                    <img src="App_Themes/Images/ajax-loader.gif" alt="" />
                </Progresstemplate>
        </asp:Updateprogress> </pre>


Please Let me know that how i gray out the page , If possible please provide the code also .
Thanks in advance.</pre>
Posted

This is just an example.

C#
.blur
{

    background-color: White;

   filter: alpha(opacity=50);
    opacity: 0.7;

    z-index: 120;

}





XML
<asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
    <ProgressTemplate>
                  <div id="Imgt"    style="position: absolute;width:1030px; height:300px;" align="center" valign="middle" runat="server" class="blur">
                  <img src="ajax-loader (5).gif"  style="position:relative;right:100px" /><br />

                  </div>
                  </ProgressTemplate>
  </asp:UpdateProgress>
 
Share this answer
 
v2
Add this in the Webpage.
ASP.NET
<asp:scriptmanager id="ScriptManger1" runat="server" enablepartialrendering="true" xmlns:asp="#unknown">
    <Scripts>
        <asp:scriptreference path="js/Progress.js" />
    </Scripts>
</asp:scriptmanager>


Css for Gray out will be like this :-
.loadingPopup
    {
	    border: 2px;
	    padding: 4px;
	    border-color: Black;
	    position: fixed;
	    top: 50%;
	    left: 50%;
	    visibility: hidden;
    }


And Finally Add this Code in the Progress.Js File and add to the solution.

JavaScript
// "Grays out" and makes the screen non-interactive when performing an update.
// To show a graphic progress "spinner" or something put it into hidden element
// id="AjaxLoading" on your page.

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function BeginRequestHandler(sender, args) {
    showProgress();
}

function EndRequestHandler(sender, args) {
    hideProgress();
}

function showProgress() {
    grayOut(true, "");
    var spinner = $get("AjaxLoading");
    if (spinner == null) return;
    spinner.style.visibility = "visible";
}

function hideProgress() {
    grayOut(false, "");
    var spinner = $get("AjaxLoading");
    if (spinner == null) return;
    spinner.style.visibility = "hidden";
}

function grayOut(vis, options) {
    var optionsoptionsoptions = options || {};
    var zindex = options.zindex || 50;
    var opacity = options.opacity || 30;
    var opaque = (opacity / 100);
    //Setting the color
    var bgcolor = options.bgcolor || '#000000';
    var dark = document.getElementById('darkenScreenObject');
    if (!dark) {
        // The dark layer doesn't exist, it's never been created.  So we'll
        // create it here and apply some basic styles.
        tbody = document.getElementsByTagName("body")[0];
        var tnode = document.createElement('div');
        tnode.style.position = 'fixed';
        tnode.style.top = '0px';
        tnode.style.left = '0px';
        tnode.style.overflow = 'hidden';
        tnode.style.display = 'none';
        tnode.id = 'darkenScreenObject';
        tbody.appendChild(tnode);
        dark = document.getElementById('darkenScreenObject');
    }

    if (vis) {
        var pageWidth = '100%';
        var pageHeight = '100%';
        dark.style.opacity = opaque;
        dark.style.MozOpacity = opaque;
        dark.style.filter = 'alpha(opacity=' + opacity + ')';
        dark.style.zIndex = zindex;
        dark.style.backgroundColor = bgcolor;
        dark.style.width = pageWidth;
        dark.style.height = pageHeight;
        dark.style.display = 'block';
    }
    else {
        dark.style.display = 'none';
    }
}
// Needed for ScriptManager to load the js properly.
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();



In This Way i had done gray out the page .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900