473,396 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inheritance + Postback issues

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 !

Nov 19 '05 #1
4 953
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"
<ad**************@gmail.com> 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/
Nov 19 '05 #2
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"
<ad**************@gmail.com> 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/
Nov 19 '05 #3
I have figured it out. I was calling a Load method incorrectly, which
was nuking a few of the properties.

Nov 19 '05 #4
I have figured it out. I was calling a Load method incorrectly, which
was nuking a few of the properties.

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
5
by: Tom Anderson | last post by:
I am currently having an issue with an ASP.Net 1.1 Web page that does the following remotely but not locally. Click on a control Check for postback, if postback, handle the event, otherwise...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
7
by: Tim_Mac | last post by:
hi, using .net 2.0, i have a web form with lots of textboxes, drop-down-lists etc. There are lots of required field validators and regular expression validators. When i click the 'save' button,...
1
by: Jason | last post by:
I have a webpage that I've wrapped in an Atlas UpdatePanel. This page contains four textboxes, each with AutoPostBack set to true. The problem comes when someone edits the first box and tabs to...
15
by: mc | last post by:
I'm writing an app for managing Task Lists, I'm trying to add some controls to a form that I can use to link tasks, my original intention was to: - Add two list boxes, one listing "all Tasks"...
7
by: =?Utf-8?B?TWlrZSBMb2dhbg==?= | last post by:
My environment. .Net 2.0 VS2k5 SP1, IE6 (6.0.2900.2180) I have a web content page. The page will post back twice if I am running in debug mode. However if I run through the breakpoints fast...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
2
by: Oriane | last post by:
Hello there, I use an Ajax slider extender and I'm try to find a workaround to a known (http://forums.asp.net/p/1092702/2681110.aspx) "bug" of the slider control from the Ajax Control Toolkit....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.