Sitefinity Intra-Site Module Webinar Notes

Sitefinity Intra-Site Module Webinar Notes

June 30, 2011 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.

Thank you to all who attended today’s webinar. Below are the resources mentioned during the webinar including the video, code snippets and the downloadable project.


Video Thumbnail

Watch on Telerik.TV

Admin Control HTML Markup

This code can be used to make your admin controls fit nicely inside Sitefinity, resembling other built-in modules with a consistent look and feel.

<h1 class="sfBreadCrumb">
    <!-- Page Title -->

<div class="sfMain sfClearfix">
    <div class="sfMain sfClearfix">
        <div class="sfAllToolsWrapper">
            <div class="sfAllTools">
                <div class="sfActions">
                    <!-- Toolbox -->
        <div class="sfWorkArea sfClearfix">
            <div class="rgTopOffset">
                <!-- Workspace -->

If you want to add a “Create” button that resembles that of other modules, use the following code in the toolbox area.

<ul> <li class="sfMainAction"><span>

<a class="sfLinkBtn sfNew" href="#">

<span class="sfLinkBtnIn">Create Item</span></a>

</span></li> </ul>

CreatePage Helper Method

This method simplifies installation of multiple pages for your backend administration.

/// <summary>
/// Creates the page.
/// </summary>
/// <param name="pageManager">The page manager.</param>
/// <param name="pageID">The ID of the page to be created.</param>
/// <param name="parentPageID">The ID of the parent page under which to create the new page.</param>
/// <param name="UrlName">Name Url used to access the page.</param>
/// <param name="ShowInNavigation">if set to <c>true</c> [show in navigation].</param>
/// <param name="Title">The page title.</param>
/// <param name="control">The web User Control to add to the page.</param>
private void CreatePage(PageManager pageManager, Guid pageID, Guid parentPageID, string UrlName, bool ShowInNavigation, string Title, PageControl control)
    // get backend node
    var parentPage = pageManager.GetPageNode(parentPageID);

    // Create a node in the SiteMap for that page. 
    var node = pageManager.CreatePageNode(pageID);
    pageManager.ChangeParent(node, parentPage);

    // set page properties
    node.RenderAsLink = true;
    node.Title = Title;
    node.ShowInNavigation = ShowInNavigation;
    node.UrlName = UrlName;

    // Create a PageData object to hold the actual page contents
    var pageData = pageManager.CreatePageData();
    pageData.Template = pageManager.GetTemplate(SiteInitializer.DefaultBackendTemplateId);
    pageData.HtmlTitle = Title;
    pageData.Title = Title;
    pageData.Status = ContentLifecycleStatus.Live;
    pageData.Visible = true;
    pageData.Version = 1;

    //associate the node with the PageData object
    node.Page = pageData;

    // add admin control to the page
    if (control != null) pageData.Controls.Add(control);

Install Widget

This code will install a widget into the “Page Controls” toolbox.

// get section from toolbox
var config = initializer.Context.GetConfig<ToolboxesConfig>();
var pageControls = config.Toolboxes["PageControls"];
var section = pageControls
    .Where<ToolboxSection>(e => e.Name == ToolboxesConfig.ContentToolboxSectionName)

// add widget to section if it doesn't exist
if (!section.Tools.Any<ToolboxItem>(e => e.Name == TestimonialsView.ViewName))
    var tool = new ToolboxItem(section.Tools)
        Name = TestimonialsView.ViewName,
        Title = "Testimonials View",
        Description = "Public control for the Testimonials module",
        ControlType = "~/Modules/Testimonials/TestimonialsView.ascx",
        CssClass = "sfTestimonialsWidget"


While developing your module, you may encounter the error “Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information”.

This problem can occur if you are modifying existing classes in your project as they may be cached in Sitefinity.

Rebuilding and restarting your website, as well as deleting your browser cache should resolve this issue

Creating an Installer Page and Uninstaller

A previous video exploring a basic intra-site module is available that explains how you can create an “Installer Page” as well as an uninstaller that will automatically delete all pages and unregister the module from Sitefinity.

This article is available here: Creating Intra-Site Modules in Sitefinity 4

Using OpenAccess

There were a few requests to see the example using OpenAccess. To see how easily you can convert this project to use OpenAccess instead of Entity Framework, take a look at this article: Building Data Layers Quickly with OpenAccess.

Download Project

A zip file containing the example code is below. This is just the module code and should be extracted into an existing Sitefinity website. If you don’t have one, be sure to register for a free trial.

Download Testimonials Intra-Site Module Example


The Progress Team

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.

Comments are disabled in preview mode.
Latest Stories in
Your Inbox
More From Progress
The New Mobile Development Landscape
Download Whitepaper
IDC Spotlight Sitefinity Thumbnail
Choosing the Right Digital Experience Platform to Improve Business Outcomes
Download Whitepaper
The Fastest Way to Build Mobile Apps With Cloud Data
Watch Webinar