1

I've been reading for hours on different ways 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.

4
  • I have this case and I've dumped the ValidationSummary and build my own .. Commented Apr 17, 2011 at 0:01
  • I just hate to do it... Already set up all of my validators. You'd think that there would be a more simple way to modify errors or perform multiple validations using the provided... Commented Apr 17, 2011 at 0:03
  • 2
    Keep your validators .. Just dump the summary. Commented Apr 17, 2011 at 0:05
  • wow... I don't know why I was thinking I had to remove both. That works for me. Thanks! Commented Apr 17, 2011 at 0:13

2 Answers 2

1

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...

Sign up to request clarification or add additional context in comments.

3 Comments

But the ErrorMessage is all handled client-side, and it's not easily accessible through server-side code.
The ErrorMessage handled automaticlly in the client by the .net when you implement this event.
right, but I think you're missing my original predicament. I needed to find a way to produce different errormessages based on server-side logic.
0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.