471,616 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,616 software developers and data experts.

Inject items in ValidationSummary control?

First, a little background. I'm trying to forge ahead into ASP.NET 2.0.
I've dome many assemblies in C#, but I've yet to have to use ASP.NET.
I'm trying to forge ahead in getting some web/server controls created so
during a future conversion the work is already done for other programmers.

I've started created common controls used in various ecommerce
checkouts. For example, credit card validation, promo vcodes validation,
etc. Some sites use both, some sites use one. In ever case, they all
just do the right thing because their validation error messages go into
a ValidationSummary control. This is all well and good for server side
validation.

However, even if the server side validates user input, the backend
systems may still throw up errors about the data the user entered...like
the promo code has expired, the credit card is a private lable and has
options, etc, etc.
What I would like to do is inject those returned errors back into the
ValidationSummary component since they will be displayed the same way,
and the Page.IsValid would be True at that point. I have no clue where
to begin with such a task and am looking for pointers to the approach.

There could be in excess of 20 errors returned, so I didn't want to
create local validators that simply checked the return codes.

Any ideas?

Thanks,
-=Chris
Jul 25 '05 #1
3 1633
Jan
use a System.Web.UI.WebControls.CustomValidator and place your server
side validation code in the ServerValidate handler.

The client side validation checks will all be done first and if they
all pass the page will post back at which point the CustomValidators
will be run.

Hope that helps,

Jan

Jul 25 '05 #2
Jan wrote:
use a System.Web.UI.WebControls.CustomValidator and place your server
side validation code in the ServerValidate handler.

The client side validation checks will all be done first and if they
all pass the page will post back at which point the CustomValidators
will be run.

Hope that helps,

Jan

I'm already using CustomValidators. The problem is, if I use 1
CustomValidator to validate data with the backend system, I need to
stuff many different ErrorMessages into the ValidationSummary, not just
the single ErrorMessage for that CustomValidator. Even if I stuff
multiple LI HTML into the ErrorMessage property, it gets wrapped in a
single LI during Render.

-=Chris
Jul 25 '05 #3
Jan
Ah I see,

Well just create a class with a static boolean attribute that stores
it's data in Session[...] like ValidationFailed.

When you start processing the serverside validators set it false;
Then set it true if a custom validator fails.
And make sure that each validator only runs if ValidationFailed is
false

Hope that helps

Jul 26 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by John Mabbott | last post: by
3 posts views Thread by Christer | last post: by
2 posts views Thread by Sunil Sabir | last post: by
5 posts views Thread by john.livermore | last post: by
1 post views Thread by Ken Varn | last post: by
3 posts views Thread by Christopher H. Laco | last post: by
2 posts views Thread by Code Rodent | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.