.NET Framework - Ajax - How disable screen until function is done

Asked By Cirene
16-Aug-08 07:43 PM
I have an ajax enabled asp.net webform.

I coded a button that does a bunch of stuff.  It could take up to 30 seconds
to process.

How can I disable everything on the screen immediately when the person
clicks the button and enable everything after the processing is completed?

Thanks!
Document.getElementById
(1)
UpdatePanel
(1)
StartRequest
(1)
BeginRequest
(1)
ModalPopup
(1)
EndRequest
(1)
Ajax
(1)
Javascript
(1)
  Cirene replied...
16-Aug-08 08:51 PM
I hope this will help people in the future.  This is how I did this...

I put all the controls in a panel, Panel1.

I added this javascript to the page....
//add event handlers to the search UpdatePanel
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(startRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);

function startRequest(sender, e) {
//disable controls during the AJAX call
document.getElementById("<%=Panel1.ClientID%>").disabled = true;
}

function endRequest(sender, e) {
//re-enable controls once the AJAX call has completed
document.getElementById("<%=Panel1.ClientID%>").disabled =
false;
}


I hope this helps someone!

Take care!
  Fabio Mastria replied...
17-Aug-08 12:49 PM
Use a modalPopup to advise the user for the working in progress

(i hope this is usefull) :)

Fabio
Create New Account
help
updated. Any ideas why? ASP.NET Discussions Page.ClientScript (1) ASP.NET (1) EndRequest (1) Document.getElementById (1) LblPublicMessage (1) UpdatePanel (1) BeginRequest (1) StartRequest (1) Well, the first thing I would do (if you haven't already) is do label is set). Basically here's all my js. . . / / add event handlers to the search UpdatePanel Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(startRequest); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); function startRequest(sender, e) { / / disable controls during the AJAX call document.getElementById("<% = Panel1.ClientID%> ").disabled = true; } function endRequest(sender, e) { / / re-enable controls once the AJAX
exception TypeError: Cannot read property 'selectedIndex' of null here is the script: function Transfer1() { if(document.getElementById("trs1").selectedIndex = = 1) { document.getElementById("TRANSFERDETAY1").style.display = "block"; document.getElementById("TRANSFERDETAY2").style.display = "none"; document.getElementById("TRANSFERDETAY3").style.display = "none"; var Transfer = Number(document.getElementById("trs1").value); var GENELTOPLAM = Number(document
print the web page but hides some controls first via the following Javascript: function printplanner() { document.getElementById("Calendar1").className = 'visno'; document.getElementById("LblCalendarInfo").className = 'visno'; document.getElementById("newmenu").className = 'visno'; document.getElementById("BtnShowCal").className = 'visno'; document.getElementById("BtnPrint").className = 'visno'; document.getElementById("BtnEmailPlanner").className = 'visno'; document.getElementById
JavaScriot or AJAX does not work? Kindly give suggestions Thank you, .NET Discussions InnerHTML (1) Document.getElementById (1) TblCustID.style.display (1) JavaScript (1) JavaScriot (1) CustID (1) TblPhone.style.display (1 use a library like 'prototype' so surmount the compatibility problems. code function validateForm() { var ddl = document.getElementById("Opts"); if(ddl.value = = 2 | | ddl.value = = 4) { if (document.getElementById('CustID').value.length = = 0) { alert('Please enter Custtomer ID'); document.getElementById('CustID').focus(); return false; } if (document.getElementById('first_name').value.length = = 0) { alert('Please enter first