UserControl and Session

H

Hai Nguyen

Hi all

I encounter a problem but don't know how to solve it.

Here is my situtation:

I have a web page, 2 user controls: A and B. A and B are dynamically loaded
into the main page. In B there are 4 buttons, TextBox, object and
classes,...There is one object I want to save all of its values and I
decided to use
Session["utility"] = myobject. For the first 3 button, I always remember to
assign that object back to the Session for the next use, and it works fine
for the first 3 buttons. The last button is a "Save All" button and I also
want to retrive that object by: myojbect =
(myclasstypehere)Session["utility"]. It breaks my code. Running debug I
receive this: myobjec is null and there is a message like this:"
Session["utility"] function 'Session.get_Item' evaluated and returned null
".

I don't know why it gave me that error. I works with 3 other buttons but not
with this.

Thanks for any help
 
V

Victor Garcia Aprea [MVP]

Hi Hai,

Assuming you're using always the proper key to identify the session item,
then there is not much to it... If you could post some more code it would
really help the guessing game...

Also try a debug session, and step through the code when clicking the "Save
All" button, check if the code that set the session item always run on each
request no matter what button is clicked, etc.
 

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

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top