Forum Moderators: not2easy

Message Too Old, No Replies

Adding in Style Sheet to a repeating table

Can this be done? or Should I use <xml>?

         

Bowdii

10:10 pm on Dec 5, 2005 (gmt 0)

10+ Year Member



Here is the scenario: I have a dataset output that needs to look pretty.

You have a webstore - > Order products (Sometimes multiply products) - > Checkout

In the checkout, the table is repeated if there are multiply products. Currently all of this is ugly b/c there is no style sheets attached. I would like to do a class to apply to the entire table.

I also thought it might be alot nicer/clearner to put it in xml... I don't know... My heads all over the place.

How would you guys/gals tackle this?

Here is my code -

<ItemTemplate>
<tr>
<td>
<tr style="padding: 0px 0px 0px 0px" height="1">
<td colspan="2" style="padding: 0px 0px 0px 0px" bgcolor="#999999" height="1"><img src="/webstorecommon/images/1x1trans.gif" width="1" height="1"></td>
</tr>
<tr>
<td colspan="2"><br>
<%# DataBinder.Eval(Container.DataItem, "productname")%>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<asp:Repeater ID="rptProducts" Runat="server" OnItemDataBound="rptProducts_ItemDataBound">
<ItemTemplate>
<tr><td><a id="aProductDetail" class="plainlink" runat="Server"><%# DataBinder.Eval(Container.DataItem, "producttype")%></a>
</td>
</tr>

</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr>
<td>
<tr style="padding: 0px 0px 0px 0px" height="1">
<td colspan="2" style="padding: 0px 0px 0px 0px" bgcolor="#999999" height="1"><img src="/webstorecommon/images/1x1trans.gif" width="1" height="1"></td>
</tr>
<tr bgcolor="#f6fbfe" style="padding: 0px 0px 0px 0px">
<td colspan="2"><br>
<%# DataBinder.Eval(Container.DataItem, "productname")%>
</td>
</tr>
<tr bgcolor="#f6fbfe" style="padding: 0px 0px 0px 0px">
<td>&nbsp;</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<asp:Repeater ID="Repeater1" Runat="server" OnItemDataBound="rptProducts_ItemDataBound">
<ItemTemplate>
<tr><td><a id="A1" class="plainlink" runat="Server"><%# DataBinder.Eval(Container.DataItem, "producttype")%></a></td></tr>
</ItemTemplate>
</asp:Repeater>
</table>

Thanks for any help!

SuzyUK

7:46 pm on Dec 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bowdii..

this might be better in the .Net forum [webmasterworld.com] in order to get that repeating code sorted out?

However you should be able to style it with CSS as it is by just adding a class/id to the outer table, than adding alternating classes to the nested tables, I'm presuming alternating because of the wording in your asp code.

<table id="product-checkout">
<tr><td> Headers etc......</td></tr>

<tr><td>
<table class="odd-row">
<tr><td> first row product</td></tr>
</table>
</td></tr>

<tr><td>
<table class="even-row">
<tr><td> second row product</td></tr>
</table>
</td></tr>

</table>

hth.. if not add more info or post over in .net

Suzy

Bowdii

9:18 pm on Dec 7, 2005 (gmt 0)

10+ Year Member



Hi Suzy -

Thanks, that is exactly what I did.

Does anyone have experince putting a style sheet on
a .net drop down?
Example:

<asp:dropdownlist id="ddlCustomerType" CssClass="drop" Runat="server" AutoPostBack="True">
<asp:ListItem Value="-1">Select Customer Type</asp:ListItem>
<asp:ListItem Value="Companies">Company</asp:ListItem>
<asp:ListItem Value="Individuals">Individual</asp:ListItem>
</asp:dropdownlist></td>

I can put a style on the overall drop down, but I would like to put something like <bold> on the header with in the box.

I will post this over in .net. But hopefully it is okay here too; I need all the help I can get;)

Thanks,

B