RegisterStartupScript and IsStartupScriptRegistered not shown in listed methods of Page

  • Thread starter Andr? Borges Medeiros
  • Start date
A

Andr? Borges Medeiros

Hi All,

I'm building an Webcontrol and overriding OnPreRender i want inject
client javascript, but RegisterStartupScript and
IsStartupScriptRegistered is not been shown in the list of methods of
Page object.

If i put Page.IsStartupScriptRegistered or Page.RegisterStartupScript
in code i don't get an Compile-Time error, but a Runtime error occurs:
NullReferenceException

Thanks in advance

André Medeiros
 
S

Sam

My guess is you are not adding this web control to the page properly
when testing it. Do you declare this control in an aspx or ascx page?
Or do you use this.Controls.Add(mycontrol) somewhere? You must do
one or the other for Page to be not null during PreRender.

-Sam
 
N

Natty Gur

Hi,

If you use VB.NET it's known issue. you wont see those methods with
intellisense but you can use them (you wont get any compile error).


HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top