H
Hugo Flores
Often people post questions about how did they loose their context
between pages, and the more common cause is that they don't store the
context on the viewstate upon postbacks.
Mine is the other way around. Even though I don't fill the context
object, I still get it after the Page Load event. May be I'm not
understanding the context object quite well.
Next is the code, and I know this wouldn't regularly transfer the
context to the next page, but that is not what I'm trying to figure
out.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If IsPostBack Then
oCustomer = viewstate("Customer")
Else
oCustomer = New Customer
oCustomer = context.Items("Customer")
viewstate("Customer") = oCustomer
End If
End Sub ====> Breakpoint here
Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdNext.Click =====> Breakpoint here
Server.Transfer("NextPage.aspx")
End Sub
The first time I load this page, I get the Customer object from the
context sent on the previous page. Then I click the Next button, and on
debugging mode I put a breakpoint on the End Sub of the Page Load
event. Here context.Items("Customer") is Nothing. Nothing wrong there,
but I also have a breakpoint on the declaration of the cmdNext Click
event, and here he context.Items("Customer") has been misteriously
filled with a Customer object.
Do anybody know, what is going on?
Thanks
between pages, and the more common cause is that they don't store the
context on the viewstate upon postbacks.
Mine is the other way around. Even though I don't fill the context
object, I still get it after the Page Load event. May be I'm not
understanding the context object quite well.
Next is the code, and I know this wouldn't regularly transfer the
context to the next page, but that is not what I'm trying to figure
out.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If IsPostBack Then
oCustomer = viewstate("Customer")
Else
oCustomer = New Customer
oCustomer = context.Items("Customer")
viewstate("Customer") = oCustomer
End If
End Sub ====> Breakpoint here
Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdNext.Click =====> Breakpoint here
Server.Transfer("NextPage.aspx")
End Sub
The first time I load this page, I get the Customer object from the
context sent on the previous page. Then I click the Next button, and on
debugging mode I put a breakpoint on the End Sub of the Page Load
event. Here context.Items("Customer") is Nothing. Nothing wrong there,
but I also have a breakpoint on the declaration of the cmdNext Click
event, and here he context.Items("Customer") has been misteriously
filled with a Customer object.
Do anybody know, what is going on?
Thanks