Anyname Donotcare
Anyname Donotcare

Reputation: 11423

How to disable the whole page under some condition in the code behind?

I have a specific page ,i want in the button click event and under some condition to disable all the controls and grayout the whole page ,showing an information message to state that the confirmation is done .


How to do that in a general way ?

Upvotes: 1

Views: 1907

Answers (5)

Muthuram
Muthuram

Reputation: 154

$(document).ready(function() {
if(Conditions satisfy){
    $('#div_controls').attr('disabled', true);
    $('#div_status').attr('disabled', false);}
else{ $('#div_controls').attr('disabled', false);
    $('#div_status').attr('disabled', True)
}

});

In HTML 

<div id="div_status"> Your Message with your styles </div>
<div id="div_controls"> Your Controls inside this Div </div>

Without any Post back,WO loosing the data, State It can be done..

or Check this demo

http://www.zurb.com/playground/reveal-modal-plugin

Upvotes: 1

Red
Red

Reputation: 6398

in HTML

<div id="layer"></div>
<div id="container">

   ----
   ----
   ----

</div>

and in CSS

#layer{
    background: none repeat scroll 0 0 white;
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100000;
}

This will disable the page ( or it will act like disabled ).

Upvotes: 0

Zaki
Zaki

Reputation: 5600

you can make all controls "invisble" after user click by

   foreach (Control c in Page.Controls)
        c.Visible = false;

Or a better way would be to use plugins such as Modal-UpdateProgress

Upvotes: 0

Justin Harvey
Justin Harvey

Reputation: 14682

Have a look at the modal popup that is included in the Ajax Control Toolkit:

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx

This will allow popup of a message that effectively prevents interaction with the rest of the page.

Upvotes: 1

Lloyd
Lloyd

Reputation: 29668

You basically want a mask. Although not exactly to your question look at this jQuery based load mask plugin, you should be able to adapt it to suit your needs:

https://code.google.com/p/jquery-loadmask/

Upvotes: 1

Related Questions