|
Subject:
|
VB shopping cart datalist ch13
|
|
Posted By:
|
Alexi
|
Post Date:
|
9/11/2006 1:53:10 AM
|
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).FindControl("PriceLabel"), Label).Text) Dim ProductName As String = CType(DataList1.Controls(0).FindControl("NameLabel"), Label).Text Dim PictureURL As String = CType(DataList1.Controls(0).FindControl("PictureUrlLabel"), 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
|
|
Reply By:
|
Alexi
|
Reply Date:
|
9/28/2006 11:54:15 PM
|
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.
|
|
Reply By:
|
DanM
|
Reply Date:
|
10/3/2006 2:34:15 AM
|
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
|
|