Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > OnServerValidate handler - how to know which CustomValidator is using it ?

Reply
Thread Tools

OnServerValidate handler - how to know which CustomValidator is using it ?

 
 
northof40
Guest
Posts: n/a
 
      10-26-2007
Hi - I have set up a number of CustomValidators all of which specify
the same method as on their 'OnServerValidate' property.

Within the method handling the custom validation how can I determine
which CustomValidator is calling ?

I would like to modify the error message dynamically but without
knowing whihc CustomValidator is firing I cannot.

Any ideas ?

Richard.

 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      10-29-2007
Try using the sender parameter
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

"northof40" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Hi - I have set up a number of CustomValidators all of which specify
> the same method as on their 'OnServerValidate' property.
>
> Within the method handling the custom validation how can I determine
> which CustomValidator is calling ?
>
> I would like to modify the error message dynamically but without
> knowing whihc CustomValidator is firing I cannot.
>
> Any ideas ?
>
> Richard.
>



 
Reply With Quote
 
 
 
 
northof40
Guest
Posts: n/a
 
      11-01-2007
On Oct 30, 9:47 am, "Nathan Sokalski" <(E-Mail Removed)> wrote:
Thanks for your reply - I'm not quite sure what you mean though.

When I look at source.ToString() I get ...

"System.Web.UI.WebControls.CustomValidator"

.... which doesn't tell me which CustomValidator is causing the handler
to fire. Maybe I misunderstood what you meant - could you expand on
it ?

Thanks

Richard.



> Try using the sender parameter
> --
> Nathan Sokalski
> (E-Mail Removed)://www.nathansokalski.com/
>
> "northof40" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) ps.com...
>
> > Hi - I have set up a number of CustomValidators all of which specify
> > the same method as on their 'OnServerValidate' property.

>
> > Within the method handling the custom validation how can I determine
> > which CustomValidator is calling ?

>
> > I would like to modify the error message dynamically but without
> > knowing whihc CustomValidator is firing I cannot.

>
> > Any ideas ?

>
> > Richard.



 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      11-02-2007
Try casting source as a CustomValidator, and then getting the ID attribute,
like the following (the following is VB.NET code):

CType(source,System.Web.UI.WebControls.CustomValid ator).ID

Because source is an Object, you must first convert it to the correct type.
Then use the ID property to determine which of the validators it is. If this
does not work, it may help if you could send us your code so that we can see
exactly what techniques you are using.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"northof40" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> On Oct 30, 9:47 am, "Nathan Sokalski" <(E-Mail Removed)> wrote:
> Thanks for your reply - I'm not quite sure what you mean though.
>
> When I look at source.ToString() I get ...
>
> "System.Web.UI.WebControls.CustomValidator"
>
> ... which doesn't tell me which CustomValidator is causing the handler
> to fire. Maybe I misunderstood what you meant - could you expand on
> it ?
>
> Thanks
>
> Richard.
>
>
>
>> Try using the sender parameter
>> --
>> Nathan Sokalski
>> (E-Mail Removed)://www.nathansokalski.com/
>>
>> "northof40" <(E-Mail Removed)> wrote in message
>>
>> news:(E-Mail Removed) ps.com...
>>
>> > Hi - I have set up a number of CustomValidators all of which specify
>> > the same method as on their 'OnServerValidate' property.

>>
>> > Within the method handling the custom validation how can I determine
>> > which CustomValidator is calling ?

>>
>> > I would like to modify the error message dynamically but without
>> > knowing whihc CustomValidator is firing I cannot.

>>
>> > Any ideas ?

>>
>> > Richard.

>
>



 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
CustomValidator ClientValidationFunction OnServerValidate Confusion labogart@hotmail.com ASP .Net 0 11-18-2009 04:47 PM
Fire OnServerValidate Method When No Value Exists in Textbox Rigs ASP .Net 0 06-28-2004 03:34 PM
OnServerValidate Mike P ASP .Net 3 10-23-2003 02:12 PM
Question about OnServerValidate jm ASP .Net 3 10-16-2003 09:10 PM



Advertisments