Accessing Page Object from class

  • Thread starter Thread starter Chris Newald
  • Start date Start date
C

Chris Newald

Hello there,

I need to be able to call the System.Web.UI.Page object inside a custom
class without actually passing the Page object as an argument. Is there an
alternate way to access the page object from within a class? Something like
the HttpContext.Current object?

My class creates custom scripts that it then adds to the page using
Page.ClientScript.IsStartupScriptRegistered and
Page.ClientScript.RegisterStartupScript functions.

Thanks in advance,
Chris
 
This worked great.

The C# version is:

System.Web.UI.Page currentPage;

currentPage = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;


Thanks Teemu!
Chris
 
Back
Top