Building sites with Razor

Smartsite 7.5 - ...

Starting with Smartsite 7.5, you can start start building websites with the language Razor, part of the Microsoft MVC framework. There are two ways to add Razor logic to your website

  1. Adding Razor translations
  2. Adding Razor logic in the logic field.

Writing Razor code in Smartsite largey matches that of the Razor language in a Microsoft Asp.Net MVC application, except that you do not have a controller and a model. The controller logic can be placed in either a @functions section like

@functions {

    public string SayYes()
    {
        return "yes";
    }
}

or you can create an assembly in Visual Studio to define the logic and reference in the Smarsite.config file.

Topics