Output variable from void method so that a javascript function can read it
<p>Hi I am trying to authenticate a user through this method</p>

<pre><code>protected void btnLogin_Click(object sender, EventArgs e)
    {
        string email = txtEmail.Text;
        string password = txtPassword.Text;

        try
        {
            bool loginResult = SingletonManager.Instance.FrontendFactories.UserFrontendFactory.LoginUser(email, FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5"), chkRememberMe.Checked);
            if (loginResult == true)
            {
                FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, true);
                Context.Items.Add("email", txtEmail.Text);
            }
            else
            {
                txtEmail.CssClass += " " + "txt-error-message";
                errorIconmaEmail.Visible = true;
                txtPassword.CssClass += " " + "txt-error-message";
                errorIconPassword.Visible = true;
            }
        }
        catch (Exception ex)
        {
            lblerror.Text = ex.Message;
        }
    }
</code></pre>

<p>Now i know it is a void method and void methods do not return values but is there a work around to sumhow create a bool in the else block (instead of the current code) such as bool isValidUser = false, so the javascript function will take care of the error message styling according to the value of this bool. FYI i am accessing the code behind public variables thorugh.</p>

<pre><code>&lt;%= isValidUser %&gt;
</code></pre>
