Accessing Page Object from class

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
 
C

Chris Newald

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
 

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

Top