Weird Dotnet Issue

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
 
K

Kevin Spencer

Apparently, when you are assigning myObject to Session["utility"], it is not
initialized, and is null. Either that, or the Session data is being lost
somehow (not likely).

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
H

Hai Nguyen

When I debugged, that object apprantely had a value. I don't know why after
postback it seemed the Session was swept out

Appreciate any suggestions

Thanks


Kevin Spencer said:
Apparently, when you are assigning myObject to Session["utility"], it is not
initialized, and is null. Either that, or the Session data is being lost
somehow (not likely).

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Hai Nguyen said:
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
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top