views:

28

answers:

1

Hello

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 this :

  1. Developer will pass the control-name, input-value and format-required
  2. For instance like for textbox it can be: txtName,txtName.Text, allow-alphabets-only
  3. 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.

A: 

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.

Jamiec
@Jamies - Please see another relevant post the link have placed in the original question. Actually there are many field which should be prompted for wrong input as soon as user leaves the control.
Rick
@Gaurav - have read linked question. Does not really add anything. For each field you need a validator, that validator should do exactly 1 thing... validate its field. There is no blanket solution to this problem.
Jamiec