You need to access the MasterPage property of your page or control, then
cast it to the type of your MasterPage. The MasterPage property is cast to
the MasterPage base type so it won't have any of the properties or controls
you may create within the master page, unless you cast it to the specific
master page type, like
((mysite.pages.mymaster)this.MasterPage).MyBody.At tribute.Add("onload","GetAccounts()");
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
"tshad" <ts***@dslextreme.comwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
In VS 2005,
I need to get access to the body tag which I have set up on my Master Page
as:
<body ID="MyBody" runat="server">
But when do something like:
MyBody.Attribute.Add("onload","GetAccounts()");
But I get:
Error 1 The name 'MyBody' does not exist in the current context
I also tried Page.MyBody, but that doesn't work either.
How can I put attributes on the body tag from a child page or control?
Thanks,
Tom