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.Attribute.Add("onload","GetAccounts()");
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
> In VS 2005,
>
[quoted text clipped - 18 lines]
>
> Tom
tshad - 04 Mar 2008 18:48 GMT
> 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.Attribute.Add("onload","GetAccounts()");
Not sure what you mean here.
Is "mysite" my namespace? I tried that but got an error. I also can't find
an entry that will allow my to put pages in. Also what is mymaster?
Thanks,
Tom
> Hope this helps,
> Mark Fitzpatrick
[quoted text clipped - 22 lines]
>>
>> Tom
> How can I put attributes on the body tag from a child page or control?
Master.FindControl("MyBody").Attribute.Add("onload","GetAccounts()");

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net