PreInit event and Master Page

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
 
C

clintonG

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
 
M

Mark Rae

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...
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top