Validation
-
I was wondering if it is possible to use some type of validator from VS.net that would validate the following: The text box can only accept a 6 number/letter combination (no more no less). The first two characters can either be numbers or letters but the last 4 have to be numbers, for example the following would be accepted: (123456, PA1234). Is there a way to validate this or do I have to use javascript?? If there is a way how would I go about it? Thanks all. Chad
-
I was wondering if it is possible to use some type of validator from VS.net that would validate the following: The text box can only accept a 6 number/letter combination (no more no less). The first two characters can either be numbers or letters but the last 4 have to be numbers, for example the following would be accepted: (123456, PA1234). Is there a way to validate this or do I have to use javascript?? If there is a way how would I go about it? Thanks all. Chad
Hi there, IMO, you can use a RequiredFieldValidator[^] to ensure that the value of the textbox is required, and you also need a RegularExpressionValidator [^] to validate the format of the value. In addition, you can use a CustomValidator [^] to provide your own logic.
-
I was wondering if it is possible to use some type of validator from VS.net that would validate the following: The text box can only accept a 6 number/letter combination (no more no less). The first two characters can either be numbers or letters but the last 4 have to be numbers, for example the following would be accepted: (123456, PA1234). Is there a way to validate this or do I have to use javascript?? If there is a way how would I go about it? Thanks all. Chad
its pretty simple. just use a regular expression validator, and associate it with your textbox. the only tricky part is the regular expression! and luckily i have it! its: ^\w{2}\d{4}$ ive not tested thoroughly, but i think it will work. good luck! ☺«««DTA»»»☺
-
its pretty simple. just use a regular expression validator, and associate it with your textbox. the only tricky part is the regular expression! and luckily i have it! its: ^\w{2}\d{4}$ ive not tested thoroughly, but i think it will work. good luck! ☺«««DTA»»»☺
Thanks guys for the posts I found this one to work very well: ^[a-zA-Z0-9]{2}\d{4}$ I was wondering where you can go to look for what that above means, i dont understand what ^, {}, d and there are a lot more taht I have no idea what they do. Thanks again. Chad
-
its pretty simple. just use a regular expression validator, and associate it with your textbox. the only tricky part is the regular expression! and luckily i have it! its: ^\w{2}\d{4}$ ive not tested thoroughly, but i think it will work. good luck! ☺«««DTA»»»☺
-
Thanks guys for the posts I found this one to work very well: ^[a-zA-Z0-9]{2}\d{4}$ I was wondering where you can go to look for what that above means, i dont understand what ^, {}, d and there are a lot more taht I have no idea what they do. Thanks again. Chad
In a RegularExpressionValidator the ^ and $ is implied, so the pattern to use is: [a-zA-Z0-9]{2}\d{4} (or [a-zA-Z\d]{2}\d{4}) Here is the reference to the regular expression syntax: js56jsgrpregexpsyntax --- b { font-weight: normal; }