Page and User Control Communication
page 1 of 7
Published: 14 Nov 2007
Abstract
This article shows how the page and user controls within the page can communicate together with a little more work. It shows how the use of interfaces or custom page classes can make the application more efficient and reduce code.
by Brian Mains
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 32975/ 49

Introduction

In .NET 1.1, the method for deployment was to build a web site, which compiled all of the ASP.NET code into a single assembly, which was deployed with the application. The benefit to this was that the application could program against the various page class models because each page was in the same assembly, the pages "knew" of each other. This is also the case in .NET 2.0, with the web application project template that can be downloaded and registered in Visual Studio.

However, native .NET 2.0 web sites do not work that way. Each page is dynamically compiled (or precompilation is an option). Because of that, each page does not know about the other because it does not exist in the same assembly. But there are ways to communicate between pages and user controls, which we shall examine in this article.


View Entire Article

User Comments

Title: a   
Name: a
Date: 2012-11-28 8:21:44 AM
Comment:
a
Title: Use events   
Name: Sowokie
Date: 2008-07-14 7:39:34 AM
Comment:
At my work we implemented a event system that makes you able to register an event(in one control) and listen for that event (in another control). This way you can also send over objects and use them. And you never have to involve the page. You just drop the controls on what page you like and they know how to talk to each other.

When this has been set up once, using it is extreamly easy. This is something i would like to have by default in the framework..

As a rule we try to use this sparingly but we have never had any speed/memory problems at all with this approach!
Title: Great that approves my way   
Name: Muhammad Mosa
Date: 2008-07-11 12:02:07 PM
Comment:
Great Brain, that actually confirm my way I'm currently using.
I faced the issue that I needed 2 user controls to be able to communicate with each others through the Page. And the way you present here is also good for such cases.
Cheers
Title: Nice Article!   
Name: Ehsan
Date: 2008-07-11 11:05:18 AM
Comment:
This article just opened my eyes up to a lot of possibilities.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 9:25:56 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search