开发者

Options for different errors with Validators

I've been reading for hours on different wa开发者_运维问答ys to get different error messages produced when validating a single control, but unfortunately I haven't stumbled upon anything that really suites what I need. I would be more than happy to modify the errormessage clientside via javascript, but some of my controls require two checks against the database, so I have to check the validity server-side. If I have to, I will stick to a single generic message. I'd really prefer not to, though.

So let's say that you had to have multiple required server-side checks going on and wanted to be able to display a different error message depending on what you find after processing. What would your decision be?

My options so far are:

1) Just go with a generic message.

2) Remove the ValidateSummary/Validators and implement my own checks when submit is clicked.

If anyone else has a suggestion, I would love to hear it.


You can use custom validator and iImplemente the "OnServerValidate" event...

This event will be in the server side, so you will be able to access db or whatever you need on the server...


I wish Akram had posted his solution as an answer rather than a comment so he could get credit. Simply removing the summary control and building my own solved my problem.

"Keep your validators .. Just dump the summary. – Akram Shahda Apr 17 at 0:05"

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜