More in this section
Blogs RSS feed

Sitefinity Intra-Site Module Webinar Notes

by User Not Found

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


Leave a comment
  1. Lino Tadros Jul 01, 2011
    Excellent Webinar, thanks Josh and Gabe!
    I was worried this was going to be a simple ASCX controls to be plugged into the backend that don't really relate to the internals of creating Modules in Sitefinity 4, but I was very happy to see that your method showed the right way of doing it by inheriting from ModuleBase and go simple steps to start for the community.  They can always keep going and add the workflow, localization, search, etc...
    Great job! and great effort!
    Have a great 4th of July guys!
  2. Peter Jul 02, 2011
    I was unfortunately unable to participate live in this webinar. When can we see this webinar here?
  3. Josh Jul 06, 2011
    the video has been posted, we apologize for the delay but the original recording was lost. Gabe and I recreated it and it is now linked above. thank you for your patience!    
  4. Richard Jul 14, 2011
    This video is absolutely great.  Well done to whoever thought it was a good idea to do this. I have read the developer guide a hundred times and it goes over my head.  This video, is REALLY good and helped me start my project properly finally.  Please, please, please, post a further webinar to progress to the next level of using Open Access, implementing other features such as custom taxonmy, permissions, and other wonderful things...
  5. Peter Jul 22, 2011
    Great video, however, I'm having an issue after the step at 00:18:05 (adding the application module in sitefinity). After a rebuild, I get the following error:

    Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

    Maybe I made a mistake somewhere (a typo while adding the module)? Problem is that I cannot get back into the advanced menu, because I'm getting this error. My whole project isn't accessible through sitefinity anymore! If someone know how to fix it (or how to get back in the situation before the installation), please help me out. 

    Thanks in advance!

  6. Josh Jul 25, 2011
    @Peter I have encountered this error before, it appears to be related to the Entity Framework. Try opening the Data Model file (edmx) and saving it, then build the project and restart the website.

    This usually fixes the problem. I have submitted this issue to the development team. I hope this is helpful!
  7. Peter Jul 26, 2011
    @Josh, thank you for your reply, but unfortunately your solution wasn't helpfull. But I have found the issue! I figured it out when I overwrote my bin directory with the one from the "_EmptyProject" folder from Sitefinity. After that, my project was running again. 

    It appears that after the "Clean" operation, the facebook.dll was deleted from my bin directory. When I re-added this dll manually, my project was running again (and I could successfully add my new module). So it hasn't something todo with your module webinar.
  8. Josh Jul 26, 2011
    Thank you for posting your soultion Peter!
  9. Richard Jul 28, 2011
    I also get this problem, and it seems to go away if I delete SitefinityWebApp.dll & .pdb from the bin directory and then build.
  10. mario araya Sep 27, 2011
    thanks Josh... this will be really helpful
  11. Nick Feb 24, 2012
    The URL parameter appears to not be working for the page view when viewing the control on a live page e.g. testimonials/john-dough.  It'll generate a "Page not found" message.  The URL does get handled when editing the testimonial witin SiteFinity e.g. testimonials/1.  I am using version 4.4.  Is there any reason why I am experiencing this?  I suspect the problem is with this line of code:

    Searching your site I found this:

    But then this note was put on the thread but am not sure if this has anything to do with what I'm seeing.
    NOTE: this behavior is subject to change in the near future because a lot of people perceive it as bug, since we don’t throw HTTP 404 exception. Nevertheless the current behavior will also be supported (configurable) and you also will be able to specify matching patterns
  12. Josh Feb 29, 2012
    Nick, you want to use the following method in your code to let Sitefinity know that the details page found the desired item and should not throw a 404:


    Although this method is currently marked obsolete, it is still the correct way to tell a page that the parameter was handled.

    For more details see Teodor's Blog Post: 404 and custom Parameters
  13. Mark McNeece Oct 23, 2012
    Hi Josh

    The link to your webinar no longer work and I desperately need help / guidance on creating this and any intra-site modules.  Is the video available anywhere else?  Do you still have a copy you could perhaps post on you tube, or even email directly to me?

    Many thanks!
  14. Josh Oct 29, 2012
    Mark, thanks for reporting this, I will update this post shortly with the correct links but in the meantime here are videos on that should get you on the right track!
  15. Josh Nov 01, 2012
    The video has been restored everyone! thanks for reporting and I apologize for the inconvenience!

    Leave a comment