views:

175

answers:

2

OK, this is my situation; I have a MasterPage. On the left hand side is a UserControl for navigation. In this UserControl I have another UserControl which shows details for the current "active" selection.

What I want to do; When a user selects, say, a Customer in the main content area I want to populate pertinent details in the ActiveSelection control (mentioned above). The only approach I've found so far is to store the relevant Customer ID in the Session then redirect back to myself. The ActiveSelection control can then retrieve this and do its thing. Far from ideal as the current page gets refreshed and its' state lost.

Note: Not sure if this is relevant but the content area of the MasterPage consists of a Panel control (rather than a ContentPlaceHolder) and UserControls are dynamically added to this Panel (not my design - of course). Shouldn't make any difference though...

Thanks in advance!

A: 

If you have two seperate controls that you want to "communicate", add an event to the controls for any trigger event, and then have the page that populates both of the controls register for the events and take any actions that are needed. This way both controls don't have to actually know about each other, and in the future anyone can consume the events from the controls.

Chris
Thanks for your suggestion Chris. The problem with this approach is that the ActiveSelection control doesn't get the opportunity to refresh/reload after it has been made aware of the event being raised.
Dave
A: 

The answer to my subsequent question (linked below) fills in the last step required to get this working i.e. to have an UpdatePanel and call Update() on this once the event has been captured and the control's values set.

ASP.NET AJAX: How can I send information to the client from server-side

Dave