Access body element from content page via a nested master page
<p>All I want to do is access the &lt;body> element from the code-behind of a content page and add a class name to it.</p>

<p>I have a top-level master page with the &lt;body> element in it. Then I have a nested master page which is the master page for the content page. From the code behind of the content page I want to add a class name to the body element. That's all.</p>

<p>I have this in the top-level master:</p>

<pre><code>&lt;body id="bodyNode" runat="server"&gt;
</code></pre>

<p>I added this to the code-behind for the content page:</p>

<pre><code>Master.bodyNode.Attributes.add("class", "home-page");
</code></pre>

<p>And I get a message that:</p>

<blockquote>
  <p>System.Web.UI.MasterPage' does not contain a definition for 'bodyNode</p>
</blockquote>

<p>If I add this to the aspx content page:</p>

<pre><code>&lt;% @ MasterType VirtualPath="~/MasterPage.master"%&gt;
</code></pre>

<p>The message then changes to:</p>

<blockquote>
  <p>bodyNode is inaccessible due to its protection level</p>
</blockquote>

<p>Please advise, I've wasted like 2 hours on what feels like something that should be really simple to do :(</p>
