Reference: Most important base classes - ViewModeUserControl class

Reference: Most important base classes - ViewModeUserControl class

April 21, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

[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 Guys

View all posts from The Progress Guys on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments are disabled in preview mode.
Latest Stories in
Your Inbox
More From Progress
5 Questions Automakers Should Ask to Improve Asset Uptime
Download Whitepaper
2018 Gartner Magic Quadrant Web Content Management (WCM)
Download Whitepaper
What Serverless Means for Enterprise Apps
Watch Webinar