RayBanUK
asked on
Shopping Cart using Datalist - Help
Im using a Datalist to list all items in a shopping cart. Im using ItemTemplate with HeaderTemplate for all the headings.
The only problem Im having is where do I put the totals? I would have thought it would be good to put it in the FooterTemplate but it doesnt like it when I put a Label in there. Do I have to do outside the Datalist and re-create another table? Please advise!
Heres my code (the data is DataBind(ed))
========================== ========== ======
<asp:DataList class="MainText" id="BasketList" runat="server" width="100%" CellPadding="2" CellSpacing="2">
<HeaderTemplate>
<tr>
<td>
ISBN
</td>
<td>
Item</td>
<td>
Quantity</td>
<td width="80" align="right">
Price</td>
<td width="80" align="right">
Line Total</td>
<td width="20"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr valign="top">
<td>
<a href="bookdetails.aspx?ISB N=<%# DataBinder.Eval(Container. DataItem, "ISBN") %>"><%# DataBinder.Eval(Container. DataItem, "ISBN")%></a></td>
<td>
<p>
<a href="bookdetails.aspx?ISB N=<%# DataBinder.Eval(Container. DataItem, "ISBN") %>"><strong><%# DataBinder.Eval(Container. DataItem, "Title") %></strong></a>
<br />
<%# DataBinder.Eval(Container. DataItem, "Subtitle") %>
<br />
<em><%# DataBinder.Eval(Container. DataItem, "Author") %></em>
</p>
</td>
<td>
<asp:TextBox id="Quantity" runat="server" Columns="4" MaxLength="3" Text='<%# DataBinder.Eval(Container. DataItem, "Quantity") %>' width="40px" />
</td>
<td align="right">
<%# DataBinder.Eval(Container. DataItem, "Price", "{0:c}") %></td>
<td align="right">
<%# DataBinder.Eval(Container. DataItem, "LineTotal", "{0:c}") %></td>
<td></td>
</tr>
</ItemTemplate>
</asp:DataList>
========================== ========== ======
The only problem Im having is where do I put the totals? I would have thought it would be good to put it in the FooterTemplate but it doesnt like it when I put a Label in there. Do I have to do outside the Datalist and re-create another table? Please advise!
Heres my code (the data is DataBind(ed))
==========================
<asp:DataList class="MainText" id="BasketList" runat="server" width="100%" CellPadding="2" CellSpacing="2">
<HeaderTemplate>
<tr>
<td>
ISBN
</td>
<td>
Item</td>
<td>
Quantity</td>
<td width="80" align="right">
Price</td>
<td width="80" align="right">
Line Total</td>
<td width="20"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr valign="top">
<td>
<a href="bookdetails.aspx?ISB
<td>
<p>
<a href="bookdetails.aspx?ISB
<br />
<%# DataBinder.Eval(Container.
<br />
<em><%# DataBinder.Eval(Container.
</p>
</td>
<td>
<asp:TextBox id="Quantity" runat="server" Columns="4" MaxLength="3" Text='<%# DataBinder.Eval(Container.
</td>
<td align="right">
<%# DataBinder.Eval(Container.
<td align="right">
<%# DataBinder.Eval(Container.
<td></td>
</tr>
</ItemTemplate>
</asp:DataList>
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No problem my friend, glad to hear you got it worked out.
Aeros
Aeros
ASKER
Thanks again.