How access the Page PreInit event from a control at runtime?

  • Thread starter Thread starter nail
  • Start date Start date
N

nail

Hi.
Anyone knows how can I change the theme from my custom control.
My custom control render a dropdownlist with the availables themes, getting
in the Themes folder.
But when I try to chane the Page.Theme property, I get this error:

The 'Theme' property can only be set in or before the Page_PreInit event

So, how can I set the Theme in or befor the Page_PreInit?

Thanks.
 
Yeah man, that exists.
But you forgot? I am developing a custom control, and if a try:

Page.Theme = Request.Form[my_custom_control]

I get the same error.
The 'Theme' property can only be set in or before the Page_PreInit event


In what event of my control do you want to put the Request.Form?

Thanks.
 
You might need to write your own httpModule and make it handle
PreRequestHandlerExecute event .??

--
Girish Bharadwaj
http://msmvps.com/gbvb
nail said:
Yeah man, that exists.
But you forgot? I am developing a custom control, and if a try:

Page.Theme = Request.Form[my_custom_control]

I get the same error.
The 'Theme' property can only be set in or before the Page_PreInit event


In what event of my control do you want to put the Request.Form?

Thanks.
 
Oh, I was thinking you could put it in the page's preinit event :) I
realize it's an ugly solution though...page reading values that control
sets...

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/


nail said:
Yeah man, that exists.
But you forgot? I am developing a custom control, and if a try:

Page.Theme = Request.Form[my_custom_control]

I get the same error.
The 'Theme' property can only be set in or before the Page_PreInit event


In what event of my control do you want to put the Request.Form?

Thanks.
 
Thank's Girish.
I try httpmodule an it works very fine.

nail

Girish Bharadwaj said:
You might need to write your own httpModule and make it handle
PreRequestHandlerExecute event .??

--
Girish Bharadwaj
http://msmvps.com/gbvb
nail said:
Yeah man, that exists.
But you forgot? I am developing a custom control, and if a try:

Page.Theme = Request.Form[my_custom_control]

I get the same error.
The 'Theme' property can only be set in or before the Page_PreInit event


In what event of my control do you want to put the Request.Form?

Thanks.


Karl Seguin said:
Thank god Request.Form is still around in 2.0, right? :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Hi.
Anyone knows how can I change the theme from my custom control.
My custom control render a dropdownlist with the availables themes,
getting
in the Themes folder.
But when I try to chane the Page.Theme property, I get this error:

The 'Theme' property can only be set in or before the Page_PreInit event

So, how can I set the Theme in or befor the Page_PreInit?

Thanks.
 

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

Back
Top