ASP.NET - INPUT button fire javascript and serverclick
if you encounter problem when you want to use an html buttom control and you wish to fire both javascript and serverclick event, you will notice that you only can fire the javascript event ONLY. inorder for you to fire both the javascript and serverclick event you can try to change the type of input to submit
html
<script type="text/javascript">
function validate()
{
if (document.getElementById('TextBox1').value =="")
{
alert("Enter value into textbox")
document.getElementById('TextBox1').focus()
return false;
}
return true;
}
</script>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<input id="Button1" runat="server" onclick="return validate();" type="submit" value="button" onserverclick="Button1_ServerClick" />
code
protected void Button1_ServerClick(object sender, EventArgs e)
{
Response.Write("B");
}