The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

One Page, Two User Controls and an event...


Anyone have any thoughts on the best way to achieve this?

I have an .aspx page, containing two user controls. When an event fires in one usercontrol I need to inform the second user control and tell it to update itself.

I've looked at event bubbling but should the parent page be doing the management of the user controls?

Thursday, May 25, 2006
There are a few ways you could handle it.

(1) When an event fires in one control, you could do a Postback and have the server do the work of updating the second control. Then reserve the page to the client. Pros: good if you have to update a LOT of data at once; and, it's simple. Cons: It's comparitively pokey, due to round-trip latency.

(2) When an event fires in one control, you could fire off an HTTPRequest to the server a la AJAX, and use the returning response to update the second control. Pros: Quicker; and it's trendy. Cons: A bit more complex depending on what you want to do; and, not a good idea if the event in the first control gets fired often by the user--a very "chatty" solution if this is the case.

(3) When an event fires in one control, you could update the second control by loading the necessary data from a javascript array having the appropriate configuration. Pros: Very quick. Cons: In dot-NET, creating and registering javascript arrays on the server can be a bit of a pain, not a really good idea if you have a large amount of data you need to update, since it may bloat the page size or overcomplicate your arrays.

With regard to event bubbling, it is absolutely right and proper for the page to manage the "controls" once they are on the client. I put "controls" in quotes, because once they are rendered at the server, they are no longer controls at all; they are HTML. It's a different paradigm on the client, where each object on the page is a node in a hierarchical (and NOT control-based) Document Object Model.

ASP.NET in my opinion, does a disservice to the developer by creating a false impression that the server renders controls to the client, when this really isn't the case at all. This adds an extra burden of becoming familiar with two worlds: the control-based world of server development, and the hierarchical, DOM-based world of client development.
Thursday, May 25, 2006
Being a java developer, I am not familiar with ASPX controls. But a solution is invented by a small company to overcome the problem, which is the communication between the components in the web page. Please see if the second solution (directory services) in the following web page helps you.

This is a small part of much larger Ajax GUI framework for SVG/XAML based platforms, which are around the corner in the near future. Which is prominently displayed (and discussed few week ago) at popular SVG community organization:

Good Luck!
Denash Sharma
Friday, May 26, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz