Inheritance + Postback issues

M

macduder83

All,

I 2 classes, parent and child class. I instantiate the child class by
doing the following:

I have a property that looks like this

Private Property propChild() As ChildClass
Get
Return CType(Session(ChildClass.NAMES.C_NAME), ChildClass)
End Get
Set(ByVal Value As ChildClass)
Session(ChildClass.NAMES.C_NAME) = Value
End Set
End Property

I then set the property by doing this

Me.propChild = new ChildClass()

When I call the constructor( new ) for the ChildClass it fires off the
New for the parent class. This is fine and desired behavior. Problem is
that ASP.NET seems to add the child class to the session and all of its
members(strings,ints and so on) the problem is that it loses all the
parent information. The parent has a few properties I need but they are
lost after a postback. I have tried useing Application and Session. I
do not want to go to viewstate as that may be the wrong place to store
complex data types. If anyone has a solution that would be greatly
appreciated.

Thanks !
 
S

Scott Allen

Hi macduder:

Do you have some more code to show how you pull the object out of
session?

--s
 
M

macduder83

I have figured it out. I was calling a Load method incorrectly, which
was nuking a few of the properties.
 

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,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top