Good community, the following happens:
<asp:Button ID="btnGuardar" runat="server" Text="Button" OnClick="btnGuardar_Click" />
<script type="text/javascript">
$(document).ready(function () {
$('#<%= btnGuardar.ClientID %>').click(function (e) {
if (document.getElementById("<%=txtPatente.ClientID%>").value == "") {
document.getElementById("<%=alertResult.ClientID%>").className = "alert alert-danger";
document.getElementById("<%=txtPatente.ClientID%>").focus();
$('#<%= lblEstado.ClientID %>').html("Ingrese una patente");
}
e.preventDefault();
});
});
</script>
The script I use for a validation so I need you not to do postback
.. but I also need to run the server-side code and I would not be doing it this way, any suggestions?