Using cookies

  • Thread starter Thread starter Jon Cosby
  • Start date Start date
J

Jon Cosby

I'm trying to use a cookie to track the customer's running total.

Private Sub dgProds_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles dgProds.SelectedIndexChanged
...

If Request.Cookies("shopping") Is Nothing Then
count = 0
price = 0
Else
count = CInt(Response.Cookies("shopping")("ItemCount"))
price = CSng(Response.Cookies("shopping")("SubTotal"))
End If

count += 1
price += CSng(dgProds.Items.Item(index).Cells(3).Text)

Response.Cookies("shopping")("SubTotal") = price.ToString()

...

"dgProds" is a Datagrid. The subtotal is always the price of the last
selected item. Do I have to use a session variable for this?
 
Back
Top