Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Inheritance + Postback issues

Reply
Thread Tools

Inheritance + Postback issues

 
 
macduder83
Guest
Posts: n/a
 
      04-14-2005
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 !

 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      04-14-2005
Hi macduder:

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

--s

On 13 Apr 2005 20:33:10 -0700, "macduder83"
<(E-Mail Removed)> wrote:

>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 !


--
Scott
http://www.OdeToCode.com/blogs/scott/
 
Reply With Quote
 
 
 
 
macduder83
Guest
Posts: n/a
 
      04-15-2005
I have figured it out. I was calling a Load method incorrectly, which
was nuking a few of the properties.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Struct inheritance against class inheritance johnsonlau C++ 1 07-21-2008 04:58 PM
Interface inheritance vs Implementation inheritance. Daniel Pitts Java 27 02-27-2008 01:37 AM
Private Inheritance and Publice Inheritance karthikbalaguru C++ 9 09-10-2007 01:05 PM
mul. inheritance & overloading operator new/delete solved by virtual base inheritance? cppsks C++ 0 10-27-2004 07:49 PM
Private access modifier and Inheritance (Inheritance implementation in Java) maxw_cc Java 1 12-21-2003 11:38 AM



Advertisments