Code for Accessing the controls of masterpage in its content page

Code for Accessing the controls of masterpage in its content page

am 31.01.2008 13:31:16 von Sonu

I have to change the controls (panel)'s top and other properties of
master page after accessing it in it's content page.

Re: Code for Accessing the controls of masterpage in its content page

am 31.01.2008 14:02:00 von Eliyahu Goldin

Use this line
<%@ MasterType virtualpath="myMasterPage.master" %>
to access public properties of the master page from the content page.

Note, that the controls in .aspx file are protected and not public. You can
make a public property like
public Panel MyPanel {get{return myPanel;}}
where myPanel is defined in the markup as


But a much better practice would be to make a public method in the master
page that will set the panel properties according to the parameters you will
pass from the content page.

And consider setting position properties on client side.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Sonu" wrote in message
news:aa56ba7b-def1-4a72-af7f-1c0e576c9ec9@d21g2000prg.google groups.com...
>I have to change the controls (panel)'s top and other properties of
> master page after accessing it in it's content page.