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.
ViewModeControl is the central class of the new Sitefinity backend architecture introduced in Sitefinity 3.6. Every time we create a View, we are basically creating a new class which inherits from the ViewModeControl (unless we are creating Views from User Controls).
In this article we will go over the ViewModeControl class, its usage and members.
public class BlogsListView : ViewModeControl<BlogsView> |
Once we have declared the class in such a way, we have declared the View and everything else that we do is an actual implementation of the View.
switch (this.ViewMode) |
{ |
case "BlogsView": |
case "BlogsPermissionsView": |
// load blog command panels |
break; |
default: |
// load post command panels |
break; |
} |
this.LinkToView2.NavigateUrl = this.CreateHostViewCommand<View2>(“someValue”); |
RadGrid dataGrid = base.Container.GetControl<RadGrid>("dataGrid", true); |
protected override void InitializeControls(Control viewContainer) |
{ |
if (!this.Page.IsPostBack) |
{ |
this.ReportForm.Visible = true; |
this.ReportCreatedPanel.Visible = false; |
} |
this.SaveReport.Click += this.SaveReport_Click; |
this.BackToReportsList.NavigateUrl = this.GetListCommand(); |
} |
protected override void CreateViews() |
{ |
AddView<BlogsView>(null, "AllBlogs", "AllBlogsDescription", "all", Messages.ResourceManager); |
AddView<BlogsPermissionsView>(null, "Permissions", "PermissionsDescription", "globalPerm", Messages.ResourceManager); |
AddView<PostsView>(); |
AddView<BlogCommentsView>(); |
AddView<BlogCategoriesView>(); |
AddView<BlogTagsView>(); |
AddView<BlogSettingsView>(); |
} |
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.