473,387 Members | 1,859 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,387 software developers and data experts.

sharing data between custom controls

I have two custom controls on a page that work on the same object that needs
some prepping when first loaded. Currently I just load them in both controls
individually, essentially doing the same work twice.

What's the best way to share data between controls? I know I could place the
data in HttpContext, but would I essentially be tripling the amount of
memory I'm using? 1 copy in control1, 1 copy in context, and 1 copy in
control2. Unless context works by reference. Otherwise, is there a better
way? The controls inherit from a common class already -- is there any way to
have a variable in that parent class that is shared within a page?

Thanks
Nov 18 '05 #1
2 1557
BTW -- there's no need to persist the data after the page is rendered. Sorry
I didn't clarify this. It's just data used while rendering the controls. The
data is needed by various controls.

"axis" <ju********************@nospam.com> wrote in message
news:qoy4d.97680$D%.48936@attbi_s51...
I have two custom controls on a page that work on the same object that
needs some prepping when first loaded. Currently I just load them in both
controls individually, essentially doing the same work twice.

What's the best way to share data between controls? I know I could place
the data in HttpContext, but would I essentially be tripling the amount of
memory I'm using? 1 copy in control1, 1 copy in context, and 1 copy in
control2. Unless context works by reference. Otherwise, is there a better
way? The controls inherit from a common class already -- is there any way
to have a variable in that parent class that is shared within a page?

Thanks

Nov 18 '05 #2
Create the object at the page level and pass it to both controls.

--
Jonathan Allen
"axis" <ju********************@nospam.com> wrote in message
news:qoy4d.97680$D%.48936@attbi_s51...
I have two custom controls on a page that work on the same object that needs some prepping when first loaded. Currently I just load them in both controls individually, essentially doing the same work twice.

What's the best way to share data between controls? I know I could place the data in HttpContext, but would I essentially be tripling the amount of
memory I'm using? 1 copy in control1, 1 copy in context, and 1 copy in
control2. Unless context works by reference. Otherwise, is there a better
way? The controls inherit from a common class already -- is there any way to have a variable in that parent class that is shared within a page?

Thanks

Nov 18 '05 #3

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

Similar topics

1
by: Vlade | last post by:
I have built a asp.net web project with site wide user controls. These controls will be used as the top and bottom of every page we make. I have the project (which is basically 1 vb class file,...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
2
by: Ajeet YS | last post by:
Hello, We need to share the same user controls among many developers in the same project. How do we achieve this? We have looked into using Custom controls, but they have a very high development...
3
by: darrel | last post by:
Is it practical? I have a site we've been working on where a lot of the objects on the page are usercontrols...the header, the footer, navigation, etc. I need to make a stand-alone mini-site...
3
by: Michael | last post by:
Hi all.. I have a solution containing 5 projects, one of which is a custom control. In one of the projects, I dragged the .ascx file from the custom control project and dropped it onto a form....
6
by: Moshe Kravchik | last post by:
Hi all! I have 2 web services, one writtenin C++ (ATL) and another one in C#. Is there a way to define data stuctures in a single place both services could use? The structures are the same, but if...
1
by: Joe | last post by:
While I understand that Server Side Includes still work, I realize it's not the best practice for sharing code such as a common set of includes between screens. In ASP.NET I've already built...
5
by: Gregory Gadow | last post by:
All done in ASP.Net 2.0 using VB... The website I am developing has a large DLL that includes custom MembershipUser, MembershipProvider and RoleProvider classes, several frequently used web...
8
by: Nathan Sokalski | last post by:
I have a form that contains a number of fields, all of which have validators. There are two submit buttons, one to update a record and one to add a record. Because the only difference in validation...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.