?
Solved

Shopping Cart using Datalist - Help

Posted on 2004-10-04
3
Medium Priority
?
385 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 375 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
Every business owner understands the significance of online customer reviews and the impact it can have on sales and revenues. With technology advancing at such a rapid pace, getting online reviews has never been easier, especially when many regions…
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.
Suggested Courses

770 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