Composite C1 support ASP.NET MVC 3 and Razor

19 January 2011

Extending Composite C1 with ASP.NET MVC3 Razor

We have added MVC 3 and Razor support to Composite C1 via the C1 Package ‘Composite.AspNet.MvcPlayer’. After installing MVC 3 and the package you can build functionality for your pages using MVC 3, including the sweet Razor syntax.

[ Error ]

Here are the steps required to start using all the MVC 3 goodies:

  1. Install MVC 3 -
  2. Get a Composite C1 site up and running – download Composite C1 if you don’t have it yet.
  3. Create a site using the easy wizard – choose the demo site to get to the Razor fun fast.
  4. In the C1 Console go to System | Packages | Available Packages and install the "Composite.AspNet.MvcPlayer " package
  5. Create (or edit) a page, add the C1 Function "Composite.AspNet.MvcPlayer" – specify "/Home" as path. Publish the page.
  6. Go create a HomeController.cs file in the /App_Code folder and paste in the code below. Note the use of App_code is atypical – your controllers should live in assemblies or App_Code.
  7. Go create a "Home" folder below "Views" (ie. ~/Views/Home) and add a Index.cshtml file to it and paste in the code below.
  8. Save all, browse the page and see MVC 3 and Razor run.

You can dive deeper into MVC3 and Razor at or read our detailed "Hello World MVC 3" guide - enjoy!

Sample HomeController.cs

[ Error ]

Sample Home/Index.cshtml view

Presentation no longer available
  .NET 4.0  ASP.NET  MVC

comments powered by Disqus