![]() |
|
|
|
#1 |
|
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 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 </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? rn5a@rediffmail.com |
|
|
|
|
#2 |
|
Posts: n/a
|
I've come across this behaviour too when using HTML table objects in a
DataList template. It is the default back colour of the table that is rendered rather than that of the template. I presume the table is there to control positioning within the template. On the occasion when I did this I ended up abandoning this method in favour of setting the width and height of the databound labels to effect positioning because with the table they wouldn't line properly with the the header. If you need to use a table and don't want the back color to dominate, try setting the back color of the table to transparent. Good luck Phil H |
|
|
|
#3 |
|
Posts: n/a
|
I tried setting the background color of the table to transparent like
this: <asp ItemStyle-BackColor="pink" runat="server"> <HeaderTemplate> <table bordercolor="black" cellspacing="0" class="format" width="100%" style="background-image: none; background-color: transparent;"> but that doesn't make any difference - the background-color of the entire table still remains white. Any other ideas? Never thought that formatting a DataList would be such a pain in the wrong place! Phil H wrote: > I've come across this behaviour too when using HTML table objects in a > DataList template. It is the default back colour of the table that is > rendered rather than that of the template. > > I presume the table is there to control positioning within the > template. On the occasion when I did this I ended up abandoning this > method in favour of setting the width and height of the databound > labels to effect positioning because with the table they wouldn't line > properly with the the header. > > If you need to use a table and don't want the back color to dominate, > try setting the back color of the table to transparent. > > Good luck rn5a@rediffmail.com |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why No One Wins in the High-Def Format War | Ablang | DVD Video | 50 | 11-04-2007 04:19 AM |
| As growth slows, Hollywood faces a DVD standoff. | Allan | DVD Video | 0 | 07-11-2005 02:10 PM |
| High Definition and the future of viewing. | Allan | DVD Video | 3 | 03-09-2005 12:56 AM |
| Format Wars Redux: Blu-ray Disc vs. HD-DVD | Ablang | DVD Video | 2 | 02-20-2005 08:06 AM |
| NYTimes: Next Video Format | robert gray | DVD Video | 12 | 01-01-2004 10:42 AM |