CNIC Validation
-
I want to put validation control for CNIC (Computed National Identity Card), if CNIC# is: 16304-1064020-6 I want the dashes to be handled automatically. like if I first enter 16304 now if I enter another digit like in this case 1 then the dash between them is automatically putted.
-
I want to put validation control for CNIC (Computed National Identity Card), if CNIC# is: 16304-1064020-6 I want the dashes to be handled automatically. like if I first enter 16304 now if I enter another digit like in this case 1 then the dash between them is automatically putted.
Then do it. Just handle the keypress of the textboxes you want, and use javascript to put dashes between numbers. You might also consider Regular Expression to validate the CNIC number after user input. (Might also make use of RegularExpressionValidator).
\d{5}[-|]\d{7}[-|]\d
I think this will work as regular expression. Try it. Well I agree, it can be made shorter. Cheers. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript