Validate PAN number in ASP.Net TextBox using Regular Expression

prynka
 
on Nov 11, 2014 04:25 AM
7831 Views

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..

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Azim
 
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}$" />