Differences for Razor with MVC3

1. Slight change when declaring global namespace in Web.Config

 <system.web.webPages.razor>
    <pages pageBaseType="">
      <namespaces>
        <add namespace="JotCMS" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>


2. MVC3 by default returns all HTML encode from the HTML Helpers. Instead of just returning string, we need to return HTMLString instead.

public static class JotContentHelper
    {
        public static HtmlString RenderJotEditControl(this HtmlHelper helper)
        {
            return new HtmlString(Jot.RenderEditControl());
        }

        public static HtmlString RenderJotContent(this HtmlHelper helper, string ContentName)
        {
            return new HtmlString(Jot.RenderJotContent(ContentName));
        }
    }

Last edited Oct 29, 2010 at 1:52 AM by jordan112, version 1

Comments

No comments yet.