Validating with out Validators
-
Hi all, I have a number of text boxes that the user can fill in. I want to make sure that the user can only use the following characters: . + - _ ( ) A-Z a-z 0-9 Unfortunately asp:validators are not working. (And I don't know why, as they used to work before importing the project from vs2003 to vs2005. Plus I don't know how to set this in the validators anyway...) I'm guessing that regular expressions are the way to go in this case (using Regex.Match(inputString, Pattern), but I don't know how to make a working regular expression. (The patterns I've been trying have ended up crashing when I include a character such a # or ' at the end of the input string.) So, any suggestions? - Munty
-
Hi all, I have a number of text boxes that the user can fill in. I want to make sure that the user can only use the following characters: . + - _ ( ) A-Z a-z 0-9 Unfortunately asp:validators are not working. (And I don't know why, as they used to work before importing the project from vs2003 to vs2005. Plus I don't know how to set this in the validators anyway...) I'm guessing that regular expressions are the way to go in this case (using Regex.Match(inputString, Pattern), but I don't know how to make a working regular expression. (The patterns I've been trying have ended up crashing when I include a character such a # or ' at the end of the input string.) So, any suggestions? - Munty
Muntyness wrote:
Plus I don't know how to set this in the validators anyway...)
How can you know they are not working, if you don't know how to use them ? A validator validates AFTER text is entered, so you could use a regex validator, but your box will still accept other characters. www.expresso.com[^], or search this site for Expresso, a tool for building regex. But, if you want to not allow those keypresses at all, you need to write javascript code that does that directly.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Muntyness wrote:
Plus I don't know how to set this in the validators anyway...)
How can you know they are not working, if you don't know how to use them ? A validator validates AFTER text is entered, so you could use a regex validator, but your box will still accept other characters. www.expresso.com[^], or search this site for Expresso, a tool for building regex. But, if you want to not allow those keypresses at all, you need to write javascript code that does that directly.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Because the validators I do know how to use are no longer working. So far I've tries two different types of validators that used to work under 2003. This bit I don't know how to do via asp validators is limiting the accepted character sets. Thanks for the Expresso comment. I'll try that out. (The link you point to leads to a parked domain, but I was able to find it here) - Munty
-
Because the validators I do know how to use are no longer working. So far I've tries two different types of validators that used to work under 2003. This bit I don't know how to do via asp validators is limiting the accepted character sets. Thanks for the Expresso comment. I'll try that out. (The link you point to leads to a parked domain, but I was able to find it here) - Munty
Can u please giv me the code related to validations of a control in ASP.Net 2.0
Priya
-
Can u please giv me the code related to validations of a control in ASP.Net 2.0
Priya
hey baby r u new in .net there are already validators in asp.net dont write any query. go to validation controls or data validator n drag n drop it will work of byeeeeeeee:laugh: lucky