title: How can I change the background of a masterpage from the code behind of a content page?
body: <p>I specifically want to add the style of <code>background-color</code> to the <code>&lt;body&gt;</code> tag of a master page, from the code behind (C#) of a content page that uses that master page.  </p>
  
  <p>I have different content pages that need to make the master page has different colors depending on which content page is loaded, so that the master page matches the content page's theme.</p>
  
  <p>I have a solution below:</p>
  
  <hr>
  
  <p>I'm looking for something more like:</p>
  
  <pre><code>Master.Attributes.Add("style", "background-color: 2e6095");
  </code></pre>
  
  <p>Inside of the page load function of the content page.  But I can't get the above line to work. I only need to change the <code>background-color</code> for the <code>&lt;body&gt;</code> tag of the page.</p>