开发者

Remove duplicate entries from validation summary asp.net

开发者 https://www.devze.com 2023-04-13 02:54 出处:网络
I have a validation summary control on my page and my required field validators are in a list view. The listview can have any number of items, therefore I will have multiple validators with the same m

I have a validation summary control on my page and my required field validators are in a list view. The listview can have any number of items, therefore I will have multiple validators with the same message. For example my list view could have 5 textboxes asking for a name, each textbox has a required field validator attached to it with the message "Please fill in your name". In my validation summary it shows 5 err开发者_StackOverflow社区or messages all saying "Please fill in your name". How can I make it so that the validation summary shows one error with something like "Names are required".

Any help is much appreciated.

Thanks


Look into using a Custom Validator. You can set the error message to "Names are required", and then in the custom validation check the status of each of your name fields. You can also wire up a Client side script with ClientValidationFunction as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号