Onclick anchor tag for calling code behind method
5 answers
<a href="#" onclick="insertOrganization();return false;" class="regular">Register</a>
InserOrganization function:
function InsertOrganization(){
if(orgvalid()){
//do your thing here
}
else
alert("not valid");
}
function orgvalid(){
if({condition for true})
return true;
else
return false;
}
+5
source to share
LinkButton can be used instead :
<asp:LinkButton id="RegisterButton"
Text="Register"
OnClientClick="return orgvalid();"
OnClick="Register_Click"
runat="server" />
and in the server function Register_Click you can call the method insertorganization
.
+3
source to share