Reference: Most important base classes - ViewModeUserControl class

April 21, 2009 Digital Experience
[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]

 

ViewModeUserControl class is a method-by-method copy of the ViewModeControl class and in that sense, the reference of the ViewModeControl can be used as a reference for the ViewModeUserControl.

 

The reason for this duplication lays in the fact that User Controls in ASP.NET have to inherit from User Control base class and since C# does not allow multiple inheritance, we were forced to create two essentially same classes, with the difference that one inherits from the CompositeControl class, while other inherits from the UserControl class.

 

There are few subtle differences one will encounter when working with ViewModeUserControl. First of all, there are no templates, since the user interface is defined in the User Control itself. Along these lines comes also the fact that InitializeControls method should not be overridden in ViewModeUserControl based Views, but rather this logic should be implemented in the Page_Load event of the User Control.

 

Finally, while we were mostly working with the types of the ViewModeControl classes, with ViewModeUserControl we are orientated on virtual paths of the UserControl (e.g. “~/MyViews/EditSomethingView.acs”).

 

The implementation examples of ViewModeUserControl class can be found in our Sample intra site module: Contacts intra site module.

The Progress Team