Question

I'm a fan of Razor & Knockout mvc & MVC,

unfortunately, we just cannot use plain MVC on our CMS(KENTICO) Solution, so I had to create a custom MVC with ASP .NET with classic ASPX.

by following a simple tutorial: http://knockoutmvc.com/BetterList

just a question, is this Razor syntax:

@using (var item = ko.Foreach(x => x.AllItems))
{
 <li>
  @item.Html.Span(x => x.FullName)                    
 </li>
}

equivalent to this ASPX syntax:

<%using (var item = ko.Foreach(x => x.AllItems))
 { %>
  <li>
   <%= item.Html.Span(x => x.FullName) %>
  </li>
 <%} %>

?

Thanks guys

Was it helpful?

Solution

The two code blocks are almost functionally equivalent.

You need to change the output from <%= to <%: (if using .NET 4.0 and above), as this adds HTML encoding to the output.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top