Getting started with Cloudix

So, you've decided to give Cloudix a quick spin and testdrive it.

There are two main options to get started. First you can run the Cloudix.Web project that is included with the source code. Alternatively, you can follow the steps from the Basic Tutorial below to quickly create a Cloudix-enabled application from scratch.

Basic Tutorial (Prerequisites)

In this tutorial we're going to explore the most simple steps possible to use Cloudix, being:
  • Creating a custom ContentProvider (presumably the most difficult part)
  • Create and prepare a MasterPage
  • Use Cloudix in your ViewPage to render content

Note: An explanation
  • Create a new ASP.NET MVC 2 Web Project (preferably an Empty MVC 2 Project).
  • Create a custom ContentProvider:
    • Add a new Model, which can be a default Class, called MyContentProvider.cs
    • Inherit this class from the ContentProvider class in Cloudix.Common and implement its members, like such
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Cloudix.Common;

namespace Cloudix.Web.Models
    public class MyContentProvider : ContentProvider
        public override string LoadContent(string contentIdOrTitle)
            // For this purpose only, we always return a string here
            return "Hello world!";
  • Configure the MasterPage
    • Add a Site.master to the Views/Shared directory
    • Add the following section to the <head> tag of the MasterPage:
<head runat="server">
        // First, create an instance of your custom ContentProvider implementation
        var provider = new MyContentProvider();

        // ... and use the ContentProvider to feed the logic behind the ScriptManager
        CloudixScriptManager.RegisterScriptManager(provider, ContentEditMode.Editable);
        // Finally, register the client side includes (such as Javascript and CSS files)

Using this in your Views

With these simple steps as prerequisites you can now enable content editing in your views directly by a syntax as simple as:
			<%: Html.RenderHtmlContent(12345) %>

This HtmlExtension has been provided for you convention and will fire up the LoadContent() function as you defined it in the first step. The '12345' parameter is the specific ContentId you wish to load.

Back to Codesamples

Last edited Aug 11, 2010 at 3:45 PM by Securancy, version 2


No comments yet.