Home All Groups Group Topic Archive Search About

Detecting if client-side validation javascript is registered?

Author
16 Mar 2006 3:09 PM
Ben Fidge
What is the correct way to determine if javascript for client-side validation
has been registered in ASP.NET 2.0?

I'm trying to debug a control that uses the following to detect:

bool bIsRegistered = Page.IsStartupScriptRegistered("ValidatorIncludeScript");

This works fine for ASP.NET 1.x, but not for 2.0. Can anyone tell me the
correct way please?

Thanks

Ben

Author
16 Mar 2006 3:16 PM
Phillip Williams
http://msdn2.microsoft.com/en-us/library/fdwe5ca7(VS.80).aspx
Show quoteHide quote
"Ben Fidge" wrote:

> What is the correct way to determine if javascript for client-side validation
> has been registered in ASP.NET 2.0?
>
> I'm trying to debug a control that uses the following to detect:
>
> bool bIsRegistered = Page.IsStartupScriptRegistered("ValidatorIncludeScript");
>
> This works fine for ASP.NET 1.x, but not for 2.0. Can anyone tell me the
> correct way please?
>
> Thanks
>
> Ben
Author
16 Mar 2006 6:00 PM
Ben Fidge
Phillip,

Thanks for that. I had already looked there but it transpires that I was
using the Page.ClientScript.IsStartupScriptRegistered method wrong. I was
using:

    Page.ClientScript.IsStartupScriptRegistered(this.GetType(),
"ValidatorIncludeScript");

but it should have been

    Page.ClientScript.IsStartupScriptRegistered(typeof(BaseValidator),
"ValidatorIncludeScript");

Regards

Ben


Show quoteHide quote
"Phillip Williams" <WEBSWAPP@newsgroups.nospam> wrote in message
news:D4412A2E-807F-4A00-AC02-6B5FB7D03403@microsoft.com...
> http://msdn2.microsoft.com/en-us/library/fdwe5ca7(VS.80).aspx
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Ben Fidge" wrote:
>
>> What is the correct way to determine if javascript for client-side
>> validation
>> has been registered in ASP.NET 2.0?
>>
>> I'm trying to debug a control that uses the following to detect:
>>
>> bool bIsRegistered =
>> Page.IsStartupScriptRegistered("ValidatorIncludeScript");
>>
>> This works fine for ASP.NET 1.x, but not for 2.0. Can anyone tell me the
>> correct way please?
>>
>> Thanks
>>
>> Ben