我的意思是,现在我们已经对您的代码中分离你的
HTML标记尽可能利用现代模板引擎的所有这种运动(在旧时代的程序员通常只是不停地串联在
PHP中,这是可怕的字符串.)
<% Html.Grid(Model).Columns(column => { column.For(x => Html.ActionLink("Edit","Edit",new { id = x.Id })).Attributes(width => "30px").DoNotEncode(); column.For(x => Html.ActionLink("Delete","Delete",new { id = x.Id },new { @class = "delete" })).Attributes(width => "95px").DoNotEncode(); column.For(x => x.Id).Named("Code"); column.For(x => x.Name).Named("Name").HeaderAttributes(align => "left"); column.For(x => x.CPF).Named("CPF"); }) .Attributes(width => "100%",border => "0",cellpadding => "0",cellspacing => "0",@class => "data-table") .Empty("No users found!") .RowStart(row => string.Format("<tr class='row{0}'>",row.IsAlternate ? "-alternating" : "")) .Render(); %>
他认为这很棒,我认为这很难看,所以我想知道更多人的意见.