G
Guest
All,
I am a bit of noob to ASP.NET, and I am writing some OO based pages to try
and emerge myself into it, however, I have come across a problem that has me
completely stumped!
What I want to do is to take an object that I am using on one page, and pass
it to another page - this, I believe is easily achievable with a session
(yes, I know about Server.Transfer for form elements, but I want an Object
based upon a class that I have written).
So, for example, lets say that I have a SqlDataReader, which I have
populated and used successfully bound to combo (dropdown) box. What I want to
do is:
'code here declares and uses sqlReader of type SqlDataReader
Session("sqlReader") = sqlReader
And then on the next page when I navigated to it:
Dim sqlReader as SqlDataReader = Session("sqlReader")
However, no matter what I try, I always get "Object reference not set to an
instance of an object. " errors.
Can anyone explain or point me in the direction of where I can find out how
to store and use objects in a session, or an alternative way of doing this? I
ultimately want to store my user-defined object in a session later on.
Many thanks for your time.
James.
I am a bit of noob to ASP.NET, and I am writing some OO based pages to try
and emerge myself into it, however, I have come across a problem that has me
completely stumped!
What I want to do is to take an object that I am using on one page, and pass
it to another page - this, I believe is easily achievable with a session
(yes, I know about Server.Transfer for form elements, but I want an Object
based upon a class that I have written).
So, for example, lets say that I have a SqlDataReader, which I have
populated and used successfully bound to combo (dropdown) box. What I want to
do is:
'code here declares and uses sqlReader of type SqlDataReader
Session("sqlReader") = sqlReader
And then on the next page when I navigated to it:
Dim sqlReader as SqlDataReader = Session("sqlReader")
However, no matter what I try, I always get "Object reference not set to an
instance of an object. " errors.
Can anyone explain or point me in the direction of where I can find out how
to store and use objects in a session, or an alternative way of doing this? I
ultimately want to store my user-defined object in a session later on.
Many thanks for your time.
James.