Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > CustomValidators without ServerValidate event

Reply
Thread Tools

CustomValidators without ServerValidate event

 
 
headware
Guest
Posts: n/a
 
      03-09-2005
Lately, I've been using the CustomValidator control without the
ServerValidate event handler. For instance, if I'm importing a file and
there is an IOException thrown, I report back to the user that there
was a problem by setting the IsValid property of a CustomValidator to
false and returning.

The real reason I do it this way is so that the error message will be
displayed in the ValidationSummary control at the top of the page.
Handling the ServerValidate event of the CustomValidator doesn't really
make sense, because there's nothing to really validate, I just want to
display the message in the ValidationSummary.

I seem to be reading that this isn't a good idea. It appears to be
working fine, and I was wondering if there is a problem with doing this
that I'm not seeing.

Thanks,
Dave

 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      03-09-2005
I don't know if it will break in a future ASP.NET 2.0 version. But the
validation framework doesn't care much how IsValid is set. It's OnPreRender
method detects IsValid is false and displays the error message. Nothing more
to it.

--- Peter Blum
www.PeterBlum.com
Email: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"headware" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Lately, I've been using the CustomValidator control without the
> ServerValidate event handler. For instance, if I'm importing a file and
> there is an IOException thrown, I report back to the user that there
> was a problem by setting the IsValid property of a CustomValidator to
> false and returning.
>
> The real reason I do it this way is so that the error message will be
> displayed in the ValidationSummary control at the top of the page.
> Handling the ServerValidate event of the CustomValidator doesn't really
> make sense, because there's nothing to really validate, I just want to
> display the message in the ValidationSummary.
>
> I seem to be reading that this isn't a good idea. It appears to be
> working fine, and I was wondering if there is a problem with doing this
> that I'm not seeing.
>
> Thanks,
> Dave
>



 
Reply With Quote
 
 
 
 
headware
Guest
Posts: n/a
 
      03-09-2005
Thanks for the reply. Let's say for a second that this did break in
ASP.NET 2.0. How would you achieve the same effect? As far as I know
you can't dynamically add error messages to a ValidationSummary
control. I guess you could use a separate Label for each error or make
your own custom control to display error messages the way you want.
However, I don't much like either of those options. Does anyone else
have any other suggestions?

Dave

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting checkbox value from DataList.HeaderTemplate for use in ServerValidate event Andy B. ASP .Net 0 02-20-2009 06:36 PM
object Source parameter in CustomValidator ServerValidate event Andy B ASP .Net 0 01-23-2009 11:10 AM
EditTemplate controls inaccessible in CustomValidator servervalidate event handler Aamir Ghanchi ASP .Net 1 10-02-2007 04:17 PM
attaching an event to ServerValidate =?Utf-8?B?RGF2ZQ==?= ASP .Net 1 05-15-2007 08:38 PM
2 CustomValidators in a Page ? TiŽsto ASP .Net 3 11-13-2004 07:23 AM



Advertisments