validation for a pan number

Posted by Subhadip under ASP.NET on 4/20/2011 | Points: 10 | Views : 9043 | Status : [Member] | Replies : 4
i am doing a project for that i want to know the code that HOW TO VALIDATE A PAN NUMBER>???????????
WANT TO KNOW VALIDATION FOR PAN NUMBER AND TIN NUMBER




Responses

Posted by: Umeshdwivedi on: 4/20/2011 [Member] Starter | Points: 25

Up
0
Down
Hello
simple you can use the validation control

Latest Technology Trainer
And Part time software consultant

Subhadip, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 4/21/2011 [Member] Starter | Points: 25

Up
0
Down
Hello Sir,

You can use regular expression to validate this.
[\w]{3}(p|P|c|C|h|H|f|F|a|A|t|T|b|B|l|L|j|J|g|G)[\w][\d]{4}[\w]$

Please take a look at it.
http://www.dotnetfunda.com/codes/code1522-validate-indian-pan-number-using-regular-expression-.aspx

To know more about regex, you can refer this article
http://www.dotnetfunda.com/articles/article1260-b-ball-c-cat-d-dog-learning-regex-regular-expression-the-easy-wa-.aspx

Thanks,
Debata

Subhadip, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 4/21/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Subhadip


use this script
<script type="text/javascript">
function Validation()
{
var a=document.getElementById('TextBox1').value;

var regex1=/^[A-Z]{5}\d{4}[A-Z]{1}$/; //this is the pattern of regular expersion
if(regex1.test(a)== false)
{
alert('Please enter valid pan number');
return false;
}
}
</script>

and add on button . .

OnClientClick="javascript:return Validation();"

Validate Indian PAN NO.

Best Regard's
Prabhakar

Subhadip, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 4/21/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Prabhakar,

That regex provided by you may not validate an Indian PAN number.
As 4th letter can contain some selected alphabates.
http://www.dotnetfunda.com/codes/code1522-validate-indian-pan-number-using-regular-expression-.aspx


Thanks,
Debata

Subhadip, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response