469,128 Members | 1,452 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,128 developers. It's quick & easy.

How to create a shopping cart?

I am trying to create a shopping cart.
on the first page the user will select which items to buy, next page they will confirm all purchases and on the last page an invoice must be displayed

Im having alot of trouble with the first page. I dont know how to select the items in a gridview store and them into an array or session variable. I tried using doin this:
Expand|Select|Wrap|Line Numbers
  1.  Dim row As GridViewRow = grdProducts.SelectedRow
  2.  
  3. AddItem(i).ID = CInt(grdProducts.SelectedRow.Cells(0).Text)
  4. AddItem(i).Name = grdProducts.SelectedRow.Cells(1).Text
  5. AddItem(i).Code = grdProducts.SelectedRow.Cells(2).Text
  6. AddItem(i).Price = CInt(grdProducts.SelectedRow.Cells(3).Text)
  7.  
  8. Session("AddedItem") = AddItem
  9.  
  10. Dim NewData As New TableCell
  11. Dim NewRow As New TableRow
  12.  
  13. NewData.Text = CStr(AddItem(1).ID)
  14. NewRow.Cells.Add(NewData)
  15. NewData = New TableCell
  16. NewData.Text = AddItem(1).Name
  17. NewRow.Cells.Add(NewData)
  18. NewData = New TableCell
  19. NewData.Text = AddItem(1).Code
  20. NewRow.Cells.Add(NewData)
  21. NewData = New TableCell
  22. NewData.Text = CStr(AddItem(1).Price)
  23. NewRow.Cells.Add(NewData)
  24.  
  25. Table1.Rows.Add(NewRow)
  26.  
but it still does not work
Oct 20 '10 #1
0 1345

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Fnark! | last post: by
2 posts views Thread by Don Grover | last post: by
5 posts views Thread by =?Utf-8?B?Q2hpV2hpdGVTb3g=?= | last post: by
1 post views Thread by jecha | last post: by
3 posts views Thread by deepaks85 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.