How to create a shopping cart?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shortie

    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:
    Code:
     Dim row As GridViewRow = grdProducts.SelectedRow
    
    AddItem(i).ID = CInt(grdProducts.SelectedRow.Cells(0).Text)
    AddItem(i).Name = grdProducts.SelectedRow.Cells(1).Text
    AddItem(i).Code = grdProducts.SelectedRow.Cells(2).Text
    AddItem(i).Price = CInt(grdProducts.SelectedRow.Cells(3).Text)
    
    Session("AddedItem") = AddItem
    
    Dim NewData As New TableCell
    Dim NewRow As New TableRow
    
    NewData.Text = CStr(AddItem(1).ID)
    NewRow.Cells.Add(NewData)
    NewData = New TableCell
    NewData.Text = AddItem(1).Name
    NewRow.Cells.Add(NewData)
    NewData = New TableCell
    NewData.Text = AddItem(1).Code
    NewRow.Cells.Add(NewData)
    NewData = New TableCell
    NewData.Text = CStr(AddItem(1).Price)
    NewRow.Cells.Add(NewData)
    
    Table1.Rows.Add(NewRow)
    but it still does not work
Working...