Solved

Shopping Cart using Datalist - Help

Posted on 2004-10-04
3
379 Views
Last Modified: 2013-11-29
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?ISBN=<%# DataBinder.Eval(Container.DataItem, "ISBN") %>"><%# DataBinder.Eval(Container.DataItem, "ISBN")%></a></td>
                                        <td>
                                            <p>
                                                <a href="bookdetails.aspx?ISBN=<%# 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>
==========================================
0
Comment
Question by:RayBanUK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 125 total points
ID: 12216461
If you want to put it in the control you will need to use a datagrid for this:

http://aspalliance.com/494
http://aspnet.4guysfromrolla.com/articles/020503-1.aspx
http://www.datawebcontrols.com/faqs/Footers/DisplayingFooterSummaryInformation.shtml

Other wise, just create a lable below the datalist and put your sums there.

Aeros
0
 

Author Comment

by:RayBanUK
ID: 12217769
Thank you, just what I needed, I found out before you posted you from a friend but will award points for finding detailed info from the web. Funny how I couldnt find them when I was looking for them! Obviosuly put wrong search words in google!

Thanks again.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12217782
No problem my friend, glad to hear you got it worked out.

Aeros
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Learn about the eCommerce marketing trends for the year ahead.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question