Validate PAN number in ASP.Net TextBox using Regular Expression

Last Reply on Nov 11, 2014 04:33 AM By Azim

Posted on Nov 11, 2014 04:25 AM

I have a textBox that will accept Pan number.

Please tell how to validate the text box,so that it will take only pan number..

Posted on Nov 11, 2014 04:33 AM

Pan Card Contain Alphanewmeric characters and of length 10.

You can use Regular Expression like this

<asp:TextBox ID="txtPanCard" runat="server" />
<asp:RegularExpressionValidator ErrorMessage="Please enter correct pan card number"
    ControlToValidate="txtPanCard" runat="server" ValidationExpression="^[a-zA-Z0-9]{10}$" />