asp.net Validation
Sample .....
<div class="col-sm-6">
<div class="form-group">
<asp:TextBox ID="txtName" runat="server" CssClass="form-control" placeholder="Name*"></asp:TextBox>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:TextBox ID="txtPhoneNumber" runat="server" CssClass="form-control" placeholder="Mobile*" MaxLength="10"></asp:TextBox>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:TextBox ID="txtEMail" runat="server" CssClass="form-control" placeholder="Email Address*"></asp:TextBox>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:TextBox ID="txtPANNUMBER" runat="server" CssClass="form-control" placeholder="PAN Number" MaxLength="10"></asp:TextBox>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<asp:TextBox ID="txtADDRESS1" runat="server" CssClass="form-control" placeholder="Address" TextMode="MultiLine" Rows="4"></asp:TextBox>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:TextBox ID="txtPINCODE" runat="server" CssClass="form-control" placeholder="Pin Code" MaxLength="6"></asp:TextBox>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:DropDownList ID="ddlDPType" runat="server" CssClass="form-control">
<asp:ListItem Value="0" Text="--Select DP Type--">--Select DP Type--</asp:ListItem>
<asp:ListItem Value="1" Text="CDSL">CDSL</asp:ListItem>
<asp:ListItem Value="2" Text="NSDL">NSDL</asp:ListItem>
</asp:DropDownList>
</div>
</div>
.............................................................................................................................................
<div class="clearfix"></div>
<div class="col-sm-6">
<div class="form-group">
<asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" CssClass="btn-submit" OnClick="btnSubmit_Click" />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" />
<div style="height: 1px; overflow: hidden">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName" Text="*" SetFocusOnError="True" ErrorMessage="Name required" Display="Dynamic" ForeColor="red"></asp:RequiredFieldValidator>
<ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" Enabled="True" TargetControlID="txtName" FilterType="LowercaseLetters,UppercaseLetters,Custom" ValidChars=".- ()"></ajaxToolkit:FilteredTextBoxExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtPhoneNumber" Text="*" SetFocusOnError="True" ErrorMessage="Mobile required"></asp:RequiredFieldValidator>
<ajaxToolkit:FilteredTextBoxExtender ID="txtPhone_FilteredTextBoxExtender" runat="server" Enabled="True" TargetControlID="txtPhoneNumber" FilterType="Numbers" ValidChars="."></ajaxToolkit:FilteredTextBoxExtender>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" ValidationExpression="[a-zA-Z0-9]{10}" runat="server" ControlToValidate="txtPhoneNumber" ErrorMessage="Phone number should be 10 digit">*</asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtEmail" Text="*" SetFocusOnError="True" ErrorMessage="Email address required"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Incorrent email" ControlToValidate="txtEmail" SetFocusOnError="True" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPANNUMBER" Text="*" SetFocusOnError="True" ErrorMessage="PAN Card Number required"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" ValidationExpression="[A-Z]{5}\d{4}[A-Z]{1}" runat="server" ControlToValidate="txtPANNUMBER" ErrorMessage="Please enter Valid PAN Card Number">*</asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtADDRESS1" Text="*" SetFocusOnError="True" ErrorMessage="Address1 requered"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" ValidationExpression="[0-9a-zA-Z #,(,),/,-]+" runat="server" ControlToValidate="txtADDRESS1" ErrorMessage="please enter Valid Address1 ">*</asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtADDRESS2" Text="*" SetFocusOnError="True" ErrorMessage="Address2 requered"></asp:RequiredFieldValidator>--%>
<%-- <asp:RegularExpressionValidator ID="RegularExpressionValidator5" ValidationExpression="[0-9a-zA-Z #,(,),/,-]+" runat="server" ControlToValidate="txtADDRESS2" ErrorMessage="Please enter Valid Address2 ">*</asp:RegularExpressionValidator>--%>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtPINCODE" Text="*" SetFocusOnError="True" ErrorMessage="PIN Code requered"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator6" ValidationExpression="[0-9]{6}" runat="server" ControlToValidate="txtPINCODE" ErrorMessage="Please enter Valid PIN Code ">*</asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator iD="RequiredFieldValidator12" runat="server" ControlToValidate="ddlCategory" ErrorMessage="Please Select a Category" InitialValue="0"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator iD="RequiredFieldValidator8" runat="server" ControlToValidate="ddlDPType" ErrorMessage="Please Select a Type" InitialValue="0"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator iD="RequiredFieldValidator9" runat="server" ControlToValidate="ddlBankName" ErrorMessage="Please Select a Bank Name" InitialValue="0"></asp:RequiredFieldValidator>--%>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txtDPNo" Text="*" SetFocusOnError="True" ErrorMessage="DP Number requered"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator8" ValidationExpression="[IN]{2}[0-9]{14}|[0-9]{16}" runat="server" ControlToValidate="txtDPNo" ErrorMessage="Please enter Valid DP Number">*</asp:RegularExpressionValidator>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="txtAccNo" Text="*" SetFocusOnError="True" ErrorMessage="Bank A/C Number requered"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator7" ValidationExpression="[0-9]{9,20}" runat="server" ControlToValidate="txtAccNo" ErrorMessage="Please enter Valid Bank A/C Number">*</asp:RegularExpressionValidator>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<a href="ipo.aspx" class="btn-reset" style="text-align: center" onclick="clearControls" >RESET</a>
</div>
</div>
No comments:
Post a Comment