Required field:
<asp:RequiredFieldValidator ID="RFUserName" runat="server" ControlToValidate="TxtUserName"
Display="Dynamic" ForeColor="Red" ErrorMessage="Enter user name."></asp:RequiredFieldValidator>
Email Address:
<asp:RegularExpressionValidator ID="regexEmailValid1" runat="server"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ControlToValidate="TxtEmailAddress" ErrorMessage="Invalid Email Format" Display="None"></asp:RegularExpressionValidator>
Function for mobile number validation.Call this function on submit button:
function IsMobileNumber(TxtMobileNo ) {
var mob = /^[1-9]{1}[0-9]{9}$/;
var txtMobile = document.getElementById(txtMobId);
if (mob.test(txtMobile.value) == false) {
alert("Please enter valid mobile number.");
txtMobile.focus();
return false;
}
return true;
}