R
rn5a
I am using a DataList control to display records from a database table.
The records are being rendered in a HTML table which is within the
DataList....something like this:
<form runat="server">
<asp
ataList ID="dlItem" AlternatingItemStyle-BackColor="lavender"
ItemStyle-BackColor="pink" runat="server">
<HeaderTemplate>
<table width="100%">
<tr>
<th>PRODUCT</th>
<th>PRICE</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Container.DataItem("Name") %></td>
<td><%# Container.DataItem("Price") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td><b>Some Text Goes Here</b></td>
</tr>
</table>
</FooterTemplate>
</asp
ataList>
</form>
Now what I find is though the DataList displays the records, the
AlternatingItemStyle-BackColor & ItemStyle-BackColor properties that I
have set within the DataList tag don't render the back color of the
rows with the colors that I have specified. In other words, the back
color of the rows aren't set to lavender & pink alternately; rather the
back color of all the rows remain white.
Is it because I am using HTML table within the DataList control? If so,
how do I format the rows in a DataList under such circumstances?
The records are being rendered in a HTML table which is within the
DataList....something like this:
<form runat="server">
<asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
ItemStyle-BackColor="pink" runat="server">
<HeaderTemplate>
<table width="100%">
<tr>
<th>PRODUCT</th>
<th>PRICE</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Container.DataItem("Name") %></td>
<td><%# Container.DataItem("Price") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td><b>Some Text Goes Here</b></td>
</tr>
</table>
</FooterTemplate>
</asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
</form>
Now what I find is though the DataList displays the records, the
AlternatingItemStyle-BackColor & ItemStyle-BackColor properties that I
have set within the DataList tag don't render the back color of the
rows with the colors that I have specified. In other words, the back
color of the rows aren't set to lavender & pink alternately; rather the
back color of all the rows remain white.
Is it because I am using HTML table within the DataList control? If so,
how do I format the rows in a DataList under such circumstances?