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.
My original table is:
<table id="tblSheet" runat="server" style="border-color: #FF9900; border-style: solid;
border-width: thin; width:100%; background-color: #99ccff;" cellspacing="4"
cellpadding="1">
I don't see the id in my intellisense, though.
Edit:
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:
<asp:RadioButtonList ID="rdoStatus" runat="server" AutoPostBack="true"
RepeatDirection="Horizontal" Visible="true"
OnSelectedIndexChanged="rdoStatus_OnSelectionChanged">
<asp:ListItem Value="181001" Text="Open"/>
<asp:ListItem Value="181002" Text="Closed" />
<asp:ListItem Value="181003" Text="Pending" />
</asp:RadioButtonList>
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.
Edit 2:
The code in my event handler is very simple:
if (rdoStatus.SelectedValue == "181003")
{
tblSheet.BgColor = "#ff9a9a";
}
else
{
tblSheet.BgColor = "#99ccff";
}