I have this javascript function :
function showLoader() {
document.getElementById("loaderState").style.display = 'inline';
}
And I have a button :
<asp:Button ID="btnSignUp" runat="server" Text="Sign Up" OnClick="btnSignUp_Click" />
I am tryong to call that js function in code behind :
protected void btnSignUp_Click(object sender, EventArgs e)
{
try
{
int i = users.AddNewUser();
if (i != 0)
{
Page.ClientScript.RegisterStartupScript(
GetType(),
"btnSignUp",
"showLoader();",
true);
}
}
catch (Exception exp)
{
throw exp;
}
}
But not worked!!! Why?
Thanks.
btnSignUp_Click, then add just this line:Page.ClientScript.RegisterStartupScript(GetType(), "btnSignUp", "showLoader();", true);? Maybe it's because theivalue is 0if(i != 0)and it work fine.