Hi,
I'm in the process of desingning a shopping cart and am having difficulty with the following, basically there is various pages with datagrids of items you can buy, on each page there is a hyperlink to another shop, the problem is when you click on the hyperlink it creates a new session as opposed to adding to it? so the items I bought from store1 will be deleted when I click the hyperlink to store2, I think it has something to do with my page load event? Any ideas?
Code:
Private Sub Page_Load(s As Object, e As EventArgs)
If Not IsPostBack Then
Dim objleathers As New leathers.OraclePhatService 'Declare variable for webservice proxy class
Dim ds As DataSet 'declare variable for dataset
ds = objleathers.GetPhatAll() 'fill dataset with Data from GetPhatAll function
dgList.DataSource = ds 'Set datasource of datagrid with data set data
dgList.DataBind() 'bind data
ddlProducts.DataSource = ds
ddlProducts.DataBind() 'bind data
makeCart()
End If
End Sub
Function makeCart()
objDT = New System.Data.DataTable("Cart")
objDT.Columns.Add("ID", GetType(Integer))
objDT.Columns("ID").AutoIncrement = True
objDT.Columns("ID").AutoIncrementSeed = 1
objDT.Columns.Add("Quantity", GetType(Integer))
objDT.Columns.Add("Product", GetType(String))
objDT.Columns.Add("Cost", GetType(Decimal))
Session("Cart") = objDT
End Function
Thanks in Advance
Rich
I'm in the process of desingning a shopping cart and am having difficulty with the following, basically there is various pages with datagrids of items you can buy, on each page there is a hyperlink to another shop, the problem is when you click on the hyperlink it creates a new session as opposed to adding to it? so the items I bought from store1 will be deleted when I click the hyperlink to store2, I think it has something to do with my page load event? Any ideas?
Code:
Private Sub Page_Load(s As Object, e As EventArgs)
If Not IsPostBack Then
Dim objleathers As New leathers.OraclePhatService 'Declare variable for webservice proxy class
Dim ds As DataSet 'declare variable for dataset
ds = objleathers.GetPhatAll() 'fill dataset with Data from GetPhatAll function
dgList.DataSource = ds 'Set datasource of datagrid with data set data
dgList.DataBind() 'bind data
ddlProducts.DataSource = ds
ddlProducts.DataBind() 'bind data
makeCart()
End If
End Sub
Function makeCart()
objDT = New System.Data.DataTable("Cart")
objDT.Columns.Add("ID", GetType(Integer))
objDT.Columns("ID").AutoIncrement = True
objDT.Columns("ID").AutoIncrementSeed = 1
objDT.Columns.Add("Quantity", GetType(Integer))
objDT.Columns.Add("Product", GetType(String))
objDT.Columns.Add("Cost", GetType(Decimal))
Session("Cart") = objDT
End Function
Thanks in Advance
Rich