Tuesday, June 23, 2009

Custom ProgressBar using Javascript

Step 1:
Create below div tags in the aspx page.

<div id="modalOut" class="modalProgressOuter">
<div id="modalIn" class="modalProgressIn">
<img src="../../Themes/Theme2/ig_progressIndicator.gif" />
</div>
</div>

Step 2:

Create stylesheet with below classes.

div.modalProgressOuter
{
background-color:White;
filter:alpha(opacity=40);
opacity:0.4;
position:absolute;
display:none;
}
div.modalProgressIn
{
vertical-align:middle;
}

Step 3:

Call the below javascript through control, i mean when you click on submit button..

function showProgress() {
var objModalProgress = document.getElementById("modalOut");
var objModalIn = document.getElementById("modalIn");
if (objModalProgress != null) {
objModalIn.style.marginLeft = parseInt(document.body.offsetWidth) / 2;
objModalIn.style.marginTop = parseInt(document.body.offsetHeight) / 2;
objModalProgress.style.height = document.body.offsetHeight;
objModalProgress.style.width = document.body.offsetWidth;
objModalProgress.style.display = "block";
objModalProgress.style.left = 10;
objModalProgress.style.top = 25;
}
}