function CheckIfEmpty(ctl)
{
/*
Here ctl is the name of
the control, whose value you want to check
*/
if (
document.getElementById
("<%=ctl.ClientID%>").value==""
)
{
alert("Field can not be blank");
document.getElementById("<%=ctl.ClientID%>").focus();
return false;
}
return true;
} <asp:TextBox ID="myTextBox" runat="server" onblur="javascript:CheckIfEmpty(form1.TextBox1)">
</asp:TextBox>
No comments:
Post a Comment