You must Sign In to post a response.
  • Category: ASP.NET

    Regular Expression Validator for pan card Number ?

    Hi Frnds
    I need validation Expression for pan card Number,
    Plz Its Urgent

    Help me
  • #351226
    Hi ,

    A per ur requirement , Use CustomValidator Control Validation

    I am sending example , here i am only check length.....for numeric refer http://forums.asp.net/t/1211724.aspx

    <form runat="server">
    <asp:Label runat="server" Text="" id="lbmsg" associatedcontrolid="txtpancard"/>
    <asp:TextBox id="txtpassword" runat="server" />
    <asp:Button Text="Submit" runat="server"/>
    <br />
    <asp:CustomValidator
    ControlToValidate="txtpancard"
    OnServerValidate="password"
    Text="Pancard must be atleast 10 characters!"
    runat="server"/>
    </form>

    ..........

    <script runat="server">
    Sub password(source As object,args As ServerValidateEventArgs)

    if args.Value. > 10 then
    args.IsValid=false
    else
    args.IsValid=true
    end if
    End Sub
    </script>

    Warm Regards
    Ashish Tiwari
    'Rome was not built in a day '

  • #351227
    <asp:RegularExpressionValidator ID="reg" runat="server" Display="Static" ControlToValidate="TextBox Id"
    ErrorMessage="Please Enter Valid Pan Number"
    ValidationExpression="[A-Z]{5}\d{4}[A-Z]{1}"></asp:RegularExpressionValidator>

    Hope this will help u

  • #351230
    ValidationExpression="[A-Z]{5}\d{4}[A-Z]{1}" you must place this expression in the properties of regular expression as validexpression

  • #351232
    Pan Card contains 10 character, computer generated code, having first 5 as alphabets followed by 4 numerals and ends with an alphabet again.

    [A-Z]{5}\d{4}[A-Z]{1}

    Thanks for Sharing


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.