Problem retrieving context values

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.
 
G

Guest

Ignore this if i got you wrong..
but Context object can hold data only for a single request.. So if you are
going to page 2 and coming back to page1 i guess you are loosing the data
because you are making two requests..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top