ASP.NET Ajax - Using jQuery BlockUI in two places; can I unblock a specific div? -
I am using the jQuery blockUI plugin (v2) because it is the rocks of Casabai.
ASP.NET is created on the AJAX request page for each, I use the InitializeRequest and EndRequest client side events to block and unblock UI, respectively - this gives me "Please wait ..." The ease with which the dialog is thrown is to get the code as follows:
var prm = Sys.WebForms.PageRequestManager.getInstance (); Prm.add_endRequest (EndRequest); Prm.add_initializeRequest (InitializeRequest); Var Blocktime; Var blockTimerFired; Function InitializeRequest (sender, args) {blockTimer = setTimeout (block page, 100); BlockTimerFired = false; } Function Endquest (Sender, Args) {unblockPage (); } Function unblockPage () {// Check that the timer has run yet, and if it is not, Cancel it (blockTimerFired) {document.body.style.cursor = "default"; $ .unblockUI (); } And {explicit timout (blocktimer); }} Function blockpage () {document.body.style.cursor = "wait"; Var loadingMessage = '& lt; Div style = "padding-top: 30px; min-height: 75px; font-weight: bold; font-size: 12pt;" & Gt; & Lt; Img align = "absmiddle" src = ".. / images / ajax-loader.gif" /> Please wait ... & lt; / Div & gt; '; $ .block ({centerX: true, center: true: CSS: {background color: '#EBB', color: '# 000'}, message: loading message)); BlockTimerFired = True; }
The above behavior works fine. However, in some cases I use the blockUI (on the same page) to create a Yes / No modal dialogue. This dialog is loaded when the document is ready.
The problem is that my $. UnblockUI () Unblock Page () calls the call to kill both. Is there a way that I can easily target a specific device with $. UnblockUI ()? For example, if I $ I can call UnblockUI ("# myYesNoDiv") , so it would be great.
When you $ BlockUI () command, it removes any existing block UI driver on the first page. I asked if I could target a specific device, but only one device exists on the page at a time , so my question was useless. sorry!
As a result, what I have to do is div, I am checking an ID and then checking to be present on the page. I was able to solve my problem with the and code:
New code:
unblockPage () {// check that What is the timer so far, and if it is not, then cancel it ($ ("# divBlockPage"). Length & gt; 0) {document.body.style.cursor = "default"; $ .unblockUI (); } And {explicit timout (blocktimer); }} // block page UI function blockpage () {document.body.style.cursor = "wait"; Var loadingMessage = '& lt; Div id = "divBlockPage" style = "padding-top: 30px; minute-height: 75px; font-weight: bold; font-size: 12pt;" & Gt; & Lt; Img align = "absmiddle" Src = "../ Images / Ajax-Loader. Gif" /> Please wait ... & lt; / Div & gt; '; $ .blu UI ({centerX: true, center: true, css: {background color: '# ebb', color: '# 000'}, message: loading message)); }
Comments
Post a Comment