473,657 Members | 2,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Objects between Web User Controls

Hi

I am after what is the best/simplest way to pass objects between Web User
Controls which doesn't use the session object.

Regards

Richard

Nov 18 '05 #1
3 3036
I do not know if this is the simplest way:

Make a PageBase derived from Page and put a member of type Object in it
(or anything that fits your needs).
Derive every page in your application from PageBase
From a web user control you have the access to the Page (you must cast
it to the PageBase) and so you can put/get something to/from there.
Richard Payne wrote:
Hi

I am after what is the best/simplest way to pass objects between Web User
Controls which doesn't use the session object.

Regards

Richard

Nov 18 '05 #2
"Richard Payne" <rp**@newsgroup s.nospam> wrote in message
news:O%******** ********@tk2msf tngp13.phx.gbl. ..
Hi

I am after what is the best/simplest way to pass objects between Web User
Controls which doesn't use the session object.


It's probably a bad idea to pass objects between web user controls. Why
should they even know about each other?

On the other hand, the page they are located within should know about all
the user controls within it. So let the page take values from one user
control and pass them to the other. Use public properties on the user
controls to enable this.

The same goes for events. One user control should probably not raise events
for another user control to handle, since they shouldn't know about each
other. Let the page handle the event from user control A and then set
properties or call methods on control B.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #3
Hi Richard,

In addition to bloomfield's sugguestion. I think if you just want to share
data between controls on the same page, I think the Page's ViewState is
also considerable. Since ViewState is a large storage for serializable
datas and will remain for all the requests for the same page.

#Understanding ASP.NET View State
http://msdn.microsoft.com/library/en...asp?frame=true

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #4

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

Similar topics

3
5556
by: SV | last post by:
Dear all, In my application I have a lot of hidden fields. I want to make them invisible for the users though for debugging reasons I want to make them visible. So I want to add these objects to an array-variable and pass this variable to a subroutine in which I make all stored objects in the array-variable invisible. Can somebody explain me how to declare the correct variables, how to pass these to a sub routine and how to make these...
8
4407
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code is passed to the lookup form/dialog by reference. I then load a...
6
3248
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A query-string flag is used to indicate to the page whether it should instantiate a new instance of the object or access an existing instance from the calling page. On the both pages I have a property of the page which is an instance of this custom...
3
3320
by: voro.cibus | last post by:
I have been reading up on this all day, and I can't find the answer (or more likely, don't understand the answers I have found) to my problem. I have a table that stores the name of my ascx page. My main page can be called on to load any of the pages referenced in my table. Therefore, I have no @Register controls in my aspx file. What I do have is this dim myUC as control = Page.LoadControl("~/reqforms/" & GetReqForm(requestID))
0
1035
by: ben | last post by:
I am having some difficulty in understanding how to deal with variables, session states, objects, user controls while attempting to develop a ASP.Net application. I have created several user controls which consist of dropdown and textbox controls on a panel. In order for one user control to access a control on another usercontrol, I have to change the WithEvents to "Protected Shared". That will allow a sub to access a control on a...
11
2552
by: Peter M. | last post by:
Hi all, I'm currently designing an n-tier application and have some doubts about my design. I have created a Data Access layer which connects to the database (SQL Server) and performs Select, update, delete and inserts. I use dataset objects to pass data to and from the DAL. In my GUI (windows forms), I use databinding to bind controls to a datatable
14
6873
by: joey.powell | last post by:
I am using VS2005 for a windows forms application. I need to be able to use a worker thread function to offload some processing from the UI thread. The worker thread will need access to a datagridview on the form. I am using the following code to spawn the worker thread... Thread WorkerThread = new Thread(new ThreadStart(WT_MyFunction)); WorkerThread.IsBackground = true; WorkerThread.Start(); The problem I am having is...I cannot seem...
5
1737
by: gwoodhouse | last post by:
Morning, My last question brought no end of fruit so i thought i would ask this: Right now, i pass object references into the constructor of forms i add to the panels in my application. Is there an easier way to access objects/controls in other panels without implicily passing the reference to them? Searching the internet, it seems not, but... Thanks in advance again!
8
1753
by: Charles Law | last post by:
This is a sort of pattern question, but relating to how components are coupled in a three-tier system. I have a presentation layer, business layer and data access layer, the first is the EXE, whilst the other two are implemented as DLLs. The EXE also references a DLL that contains various user controls, one of which is based on a grid control. The coupling is currently like this:
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.