There is another relevant question asked Validation Check in asp.net
In the same scenario we need a custom validator control which will alert user for any wrong entry. This will work like th开发者_开发百科is :
- Developer will pass the control-name, input-value and format-required
- For instance like for textbox it can be: txtName,txtName.Text, allow-alphabets-only
- The accordingly format if the user input is invalid he/she will be got prompt.
Please suggest the right way to do the smae.
Thanks in advance.
You've described the default behaviour of all asp.net validators (pass control to validate etc).
What you want to achive (eg, alpha charaters only, or alphanumeric only etc) can be achieved mostly with the RegularExpressionValidator.
精彩评论