Thursday, December 13, 2018

the land before Razor

Do you kids remember this view syntax from the first two versions of ASP.NET MVC before Razor showed up?

<% if (!String.IsNullOrEmpty(Model.PurchaseOrder))
   { %>
<div class="po">
   <p>PO #: <%= Model.PurchaseOrder %></p>
</div>
<% } %>

 
 

The model binding at the top of a view looked like this:

<%@ Page Title="" Language="C#"
      MasterPageFile="~/Views/Shared/OrderMaster.Master"
      Inherits="System.Web.Mvc.ViewPage<SomethingErOther.Models.Order>" %>

 
 

Loop in a partial like so:

<% Html.RenderAction("Index", "Foo", Model.Bar); %>

No comments:

Post a Comment