Number validation in required field validator

后端 未结 7 1418
挽巷
挽巷 2021-02-05 08:08

Is it possible to put Number validation in required field validator in asp.net text box?

7条回答
  •  隐瞒了意图╮
    2021-02-05 08:26

    A RequiredFieldValidator only checks if the field is filled in. It doesn't care what with.

    You will need an extra CompareValidator with it's Operator set to DataTypeCheck and it's Type set to Integer. Note you need both: the CompareValidator will ignore an empty input.

提交回复
热议问题