Call Javascript from function based on condition
<p>I have a jQuery modal system that I have built and would like to trigger the modal to popup if the username or password entered by a user is invalid. I need to do these checks from the C# codebehind in ASP, and then if there is an invalid username or password trigger my javascript function: showModal("errorDiv").</p>

<p>Is this possible?</p>

<p>I don't want to bind the javascript to a button click but rather on the condition of block of code on a button click.</p>

<p>So basically</p>

<pre><code>btnSubmit_OnClick(sender, e)
{
   if (Username.Exists())
      //// Continue on
   else
        call showModal("errorDiv");

}
</code></pre>

<p>Any help?</p>
