PreInit event and Master Page

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I need to set, at runtime, MyLabel.SkinID="MySkinID".

I know this must be done in Page PreInit event.

However, MyLabel is in my Master Page.

I tried to add the Page PreInit event on my master page but it is not
available. Only in normal pages.

How can I solve this?

Thanks,

Miguel
 
I think its correct to say we are compelled to use a base class which
inherits from System.Web.UI.Page and use the code-behind of the base class
to manage selecting or changing the Master, Themes, and/or Skins.

We can then write public properties or use the FindControl method to
reference controls. A simple example of using FindControl would look like
this...

Label myLabel = (Label)Master.FindControl("MyLabel");
myLabel.SkinID = "MySkinID";

Go to http://www.odetocode.com/ where you will find extensive blogging about
this topic.

<%= Clinton
 
I think its correct to say we are compelled to use a base class which
inherits from System.Web.UI.Page and use the code-behind of the base class
to manage selecting or changing the Master, Themes, and/or Skins.

That's how I do it - I don't know of any other way...
 
Back
Top