A
antonyliu2002
This message was originally a follow-up in a thread, but it went
ignored and I do want some help so I am initiating it as a new topic.
After Patrick and Karl showed me some examples, I was trying to retain
user data across multiple pages using the Context facility.
On page1.aspx, I have
Page1 | Page2 |
First Name:
Last Name:
Where Page1 and Page2 are LinkButton objects that point to the
respective pages. These two buttons also appear on page2.aspx.
On page2.aspx, I do get the info transferred from page1.aspx. But when
I hit the LinkButton Page1 to go back, the information is lost. And on
page1.aspx, I do have the following Sub:
Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
txtFirst.Text = Context.Items("first")
txtLast.Text = Context.Items("last")
End If
End Sub
Presumably, this sub should be able to retrieve the values from the
context and put them back to their respective textboxes.
I tried CTyping like so,
txtFirst.Text = CType(Context.Items("first"), String)
txtLast.Text = CType(Context.Items("Last"), String)
It did not help.
Well, I know that the values will still be there if I hit the back
button of the browser. But that is not what I want.
Please let me know where I went wrong. Thanks a lot.
ignored and I do want some help so I am initiating it as a new topic.
After Patrick and Karl showed me some examples, I was trying to retain
user data across multiple pages using the Context facility.
On page1.aspx, I have
Page1 | Page2 |
First Name:
Last Name:
Where Page1 and Page2 are LinkButton objects that point to the
respective pages. These two buttons also appear on page2.aspx.
On page2.aspx, I do get the info transferred from page1.aspx. But when
I hit the LinkButton Page1 to go back, the information is lost. And on
page1.aspx, I do have the following Sub:
Sub Page_Load(sender As Object, e As EventArgs)
If Not Page.IsPostBack Then
txtFirst.Text = Context.Items("first")
txtLast.Text = Context.Items("last")
End If
End Sub
Presumably, this sub should be able to retrieve the values from the
context and put them back to their respective textboxes.
I tried CTyping like so,
txtFirst.Text = CType(Context.Items("first"), String)
txtLast.Text = CType(Context.Items("Last"), String)
It did not help.
Well, I know that the values will still be there if I hit the back
button of the browser. But that is not what I want.
Please let me know where I went wrong. Thanks a lot.