Dear Mark,
Code on the first page:
Protected Sub btnCheckOut_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnCheckOut.Click
Response.Redirect("CheckOut.aspx")
End Sub
Second page:
Partial Class CheckOut
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim myCustomer As New Customer
If Session("Customer") IsNot Nothing Then
Me.txtFirstName.Text =
Session("Customer").Firstname()
Me.txtLastName.Text =
Session("Customer").LastName()
Me.txtMail.Text =
Session("Customer").Email()
End If
End Sub
Protected Sub btnShopping_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles btnShopping.Click
If Session("Customer") Is Nothing And Page.IsValid Then
Dim myNewCustomer As New Customer
myNewCustomer.FirstName = Me.txtFirstName.Text
myNewCustomer.LastName = Me.txtLastName.Text
myNewCustomer.Email = Me.txtMail.Text
Session.Add("Customer", myNewCustomer)
Else
Session("Customer").Firstname() =
Me.txtFirstName.Text
Session("Customer").LastName() =
Me.txtLastName.Text
Session("Customer").Email() = Me.txtMail.Text
End If
Response.Redirect("cart.aspx")
End Sub
End Class
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netschreef in bericht
news:OT*************@TK2MSFTNGP05.phx.gbl...
"John Devlon" <jo********@hotmail.comwrote in message
news:ja**********************@phobos.telenet-ops.be...
>Yes, I'm using ASP.NET... And I'm checking for a particalar session
variable...
OK. For future reference, it really helps if you use the correct terms for
things, otherwise people constantly have to ask you what you really
mean...
>Every time, the second page is loaded, some information is read from the
session variable...
I just would like to know why the second time the page is visited and a
button is clicked, the values of the first time is used, and not the new
ones ...
>How can I prevent this ?
It's a little difficult to say for sure as you haven't shown any of your
code, but I'm suspecting that you've forgotten to wrap your Page_Load code
in an if (!IsPostBack) loop...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net