Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Format DataList

 
Thread Tools Search this Thread
Old 10-01-2006, 10:18 PM   #1
Default Format DataList


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">
<aspataList 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>

</aspataList>
</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
  Reply With Quote
Old 10-02-2006, 08:20 AM   #2
Phil H
 
Posts: n/a
Default Re: Format DataList
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
  Reply With Quote
Old 10-05-2006, 10:25 PM   #3
rn5a@rediffmail.com
 
Posts: n/a
Default Re: Format DataList
I tried setting the background color of the table to transparent like
this:

<aspataList ID="dlYourCart" AlternatingItemStyle-BackColor="lavender"
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46