Hi to all master of asp.net and c#
how to do the client side validation using c# and with out using required field validation control i wrote the code of javascript in head tab and i write in page_load method
protected void Page_Load(object sender, EventArgs e)
{
btnAdd.Attributes.Add("onclick", "return validate()");
}
but its not checking the fields and javascript is
<script language="javascript" type="text/javascript">
function Validate()
{
if(document.getElementById("<%=txtRefNo.ClientID%>").value=="")
{
alert("Please Enter Your Reference Number");
document.getElementById("<%=txtRefNo.ClientID%>").focus();
return false;
}
}
</script>
where i am doing mistake i don't know