For some reason in the C# code behind for asp.net, i cannot call the table by it's ID to set it's back color property. I tried and and nothing seems to work
Here is my asp.net table tag:
<table id="ptbl" runat="server" cellpadding="2" width="640px" border="1">
here is something similar to what i what to do in the C# code behind but it does not recognize the id
ptbl.Attributes.Add("style", "background-color:red")");
Any ideas/suggestions?
Update: here is the code. There is a layout template in it so somehow it can't see the table id, but if I take that out of it then it sees it. What can i do. I need the listview to get the data
<asp:ListView ID="ListView1" runat="server" Style="color: white; font-weight: bold">
<LayoutTemplate>
<table id="ptbl" runat="server" cellpadding="2" width="640px" border="1" style="color: black; font-weight: bold">
<tr runat="server">
<th runat="server">Ps</th>
<th runat="server">P</th>
<th runat="server">T</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
<asp:DataPager runat="server" ID="ContactsDataPager" PageSize="90">
<Fields>
<asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true"
FirstPageText="|<< " LastPageText=" >>|"
NextPageText=" > " PreviousPageText=" < " />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="Label1" runat="server"><%# Eval("Ps") %></asp:Label></td>
<td>
<asp:Label ID="Label2" runat="server"><%# Eval("P") %></asp:Label></td>
<td>
<asp:Label ID="Label3" runat="server"><%# Eval("T") %></asp:Label></td>
</tr>
</ItemTemplate>
</asp:ListView>
Again the layout template is causing the issue. how can i use the listview and the table with the layout template. I know this has morphed a bit now , but any help would be appreciated.