title: How to unblock a blocked page with jquery-blockui?
body: <p>I start to using <a href="http://jquery.malsup.com/block/" rel="nofollow">jQuery BlockUI Plugin</a> to block user activity for the page until complete a button process on C#/ASP.NET side.</p>
  
  <p>So I wrote this;</p>
  
  <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"&gt;&lt;/script&gt; 
  &lt;script src="http://malsup.github.io/min/jquery.blockUI.min.js" &gt;&lt;/script&gt; 
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $('#MyButtonID').click(function () {
              $.blockUI({ message: '&lt;h1&gt;Please wait..&lt;/h1&gt;' });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>As you can see, this is a simple code that blocks UI when I click <code>asp:button</code> which <code>ID</code> is <code>MyButtonID</code> until it finish it's process. This works great.</p>
  
  <p>Now I try to create some alert based on a condition while on this click process. If I understand clearly, now I need to unblock my page as a first, show the alert and keep it blocked again until complete button process.</p>
  
  <p>That's why I wrote two function (<em>maybe I can call these <code>$.unblockUI</code> and <code>$.blockUI</code> directly without them?</em>) in my javascript side for that;</p>
  
  <pre><code>function UnblockUI() {
      $.unblockUI();
  }
  function BlockUI() {
      $.blockUI({ message: '&lt;h1&gt;Please wait..&lt;/h1&gt;' });
  }
  </code></pre>
  
  <p>As far as I search, most common way to call Javascript function on server side is using <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerstartupscript.aspx" rel="nofollow"><code>ClientScriptManager.RegisterStartupScript</code></a> method in C#. So I tried to alert something on C# side as an example with;</p>
  
  <pre><code>if(condition)
  {
      string script = string.Format("alert('{0}');", "Some error message");
      Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "alert", script, true);
  }
  </code></pre>
  
  <p>and it worked. After that, I tried to unblock page with calling UnblockUI function in my javascript side but it didn't unblock it.</p>
  
  <pre><code>if(condition)
  {
      Page.ClientScript.RegisterStartupScript(this.GetType(), "unblock", "UnblockUI", true);
      string script = string.Format("alert('{0}');", "Some error message");
      Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "alert", script, true);
  }
  </code></pre>
  
  <p>If I understand correctly, this <code>UnblockUI</code> parameter calls my <code>UnblockUI</code> javascript  function which I defined above and this function calls <code>$.unblockUI();</code> and unblock my page which is blocked but as expected, it didn't work.</p>
  
  <p>What am I missing here? Or am I didn't <em>even</em> understand that <em>This plugin lets you simulate synchronous behavior when using AJAX, without locking the browser</em> sentence?</p>