title: How do I set a table background programmatically while running an asp.net page?
body: <p>I have an aspx page that has one background color as the default.  I need to be able to change it programmatically when a certain option of a radio button is selected.  I tried setting the ID field of the table, but I can't seem to access it in my C# code behind file.</p>
  
  <p>My original table is:</p>
  
  <pre><code>&lt;table id="tblSheet" runat="server" style="border-color: #FF9900; border-style: solid; 
  border-width:  thin; width:100%; background-color: #99ccff;" cellspacing="4" 
  cellpadding="1"&gt;
  </code></pre>
  
  <p>I don't see the id in my intellisense, though.</p>
  
  <p><strong>Edit:</strong><br>
  Now that I can see my table in my code behind, I'm trying to actually change the background color.  Here is the code for my radiobuttonlist:  </p>
  
  <pre><code>&lt;asp:RadioButtonList ID="rdoStatus" runat="server" AutoPostBack="true"
  RepeatDirection="Horizontal" Visible="true"   
  OnSelectedIndexChanged="rdoStatus_OnSelectionChanged"&gt;
  &lt;asp:ListItem Value="181001" Text="Open"/&gt;
  &lt;asp:ListItem Value="181002" Text="Closed" /&gt;
  &lt;asp:ListItem Value="181003" Text="Pending" /&gt;
  &lt;/asp:RadioButtonList&gt;
  </code></pre>
  
  <p>I'm hitting the breakpoint I set in the event handler, but the background color is not changing on postback.  If the item chosen is Pending, then I want to change the background color to something different.  If they change the radio button to Open Or Closed, then I want to make sure the background color is the default.</p>
  
  <p><strong>Edit 2:</strong><br>
  The code in my event handler is very simple:</p>
  
  <pre><code>if (rdoStatus.SelectedValue == "181003")
  {
    tblSheet.BgColor = "#ff9a9a";
  }
  else
  {
    tblSheet.BgColor = "#99ccff";
  }
  </code></pre>