Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 01:53 AM
Registered User
 
Join Date: Aug 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB shopping cart datalist ch13

Hi,

Just trying to make the add to cart button to work from the datalist on the wroxshop.aspx - how to I amend the code to point towards the selected row. This is the original code:

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
        Dim Price As String = Double.Parse(CType(DataList1.Controls(0).FindContr ol("PriceLabel"), Label).Text)
        Dim ProductName As String = CType(DataList1.Controls(0).FindControl("NameLabel "), Label).Text
        Dim PictureURL As String = CType(DataList1.Controls(0).FindControl("PictureUr lLabel"), Label).Text
        Dim ProductID As Integer = CInt(Request.QueryString("ProductID"))
        If Profile.Cart Is Nothing Then
            Profile.Cart = New Wrox.Commerce.WroxShoppingCart()
        End If
        Profile.Cart.Insert(ProductID, Price, 1, ProductName, PictureURL)
        Server.Transfer("WroxShop.aspx")
    End Sub


I just copied and pasted the code, and it only selects the first item, no matter which button I click. It looks for the Name Label control, but selects only the fist one. How to do I differentiate them?

Any ideas?

Thanks

Alexi

 
Old September 28th, 2006, 11:54 PM
Registered User
 
Join Date: Aug 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's cool, I figured it out. The guys at www.asp.net forum are so more helpful than here it's not even funny.

 
Old October 3rd, 2006, 02:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

Hi Alexi,

Sorry we weren't on the ball here. Could you leave us a link to the thread on asp.net for reference?

Thanks, Dan

Dan Maharry
Read the feed at http://feeds.feedburner.com/dansarchive





Similar Threads
Thread Thread Starter Forum Replies Last Post
Shopping Cart seannie ASP.NET 2.0 Basics 0 December 12th, 2006 10:28 AM
Shopping Cart inkrajesh ASP.NET 1.0 and 1.1 Basics 2 February 28th, 2006 03:08 AM
shopping cart isheikh BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 October 8th, 2004 04:20 PM
C# shopping cart franknguyen ASP.NET 1.x and 2.0 Application Design 1 January 5th, 2004 10:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.