Dynamically Loading User Control in WCSF

Topics: Web Client Software Factory
Jun 24, 2010 at 7:30 AM

My way to dynamically load user control is as follows:

string controlPath = "~/LSx/Controls/UCItem.ascx";

IUCItemView ucitem = (IUCItemView)this.View.ExecPage.LoadControl(controlPath);

IUCItemView is User Control View interface and this.View.ExecPage is current Page.

In this approach presenter is always null so that I can create it manually : ucitem.ucItemPresenter = new UCItemPresenter(controller);

Whether this approach is good and how can I subscribe from parent page (this.View.ExecPage) to the events in user control presenter?

Jun 25, 2010 at 9:05 AM

If anyone interested I found a solution.

On this link you can find a complete solution with source code : 

http://mats.softgear.se/post/Adding-communication-between-user-controls-without-involving-the-web-form.aspx