using custom validator to validate an regular expression
hello sir,
by using custom validator to validate an regular expression with email id how to write a code in OnServerValidate propertie anybody can help me to solve please................
below of my code is:
Client Side Javascript:
function ValidateEmailId(source, args) {
var rdbemailid = document.getElementById("<%=rdb_No.ClientID %>");
var emilid = $("#<%= txtEmail.ClientID %>").val();
if (rdbemailid.checked) {
if (emilid == "") {
args.IsValid = false;
}
else {
args.IsValid = true;
}
}
}
<asp:TextBox ID="txtEmail" runat="server"/>
<asp:CustomValidator ID="cvemail" runat="server" ClientValidationFunction = "ValidateEmailId" OnServerValidate = "validateserver" Text="Please Enter EmailId" ControlToValidate="txtEmail" ValidateEmptyText="true" ErrorMessage="Please Enter Valid EmailId" ForeColor="Red"></asp:CustomValidator>