一:集合与普通对象

[html] view plain copy
  1. @foreach (Dao.DTO.DTO_LogisticsDictionary p in ViewBag.dlds)  
  2.            {  
  3.                <div class="dict-part clearfix mb20"><h3><span>Country/Area:<font style="color:#333; font-size:16px;">@p.CountryName</font></span>@p.CompanyName</h3>  
  4.                <p style="height:98px; overflow:hidden">@Html.Raw(p.CompanyIntroduce.Replace("th_yh","'").Replace("brHH","<br/>"))</p>  
  5.                <div class="dict-btn"><a href="#" onclick='logdic.vdOnclick(" + @p.Id + ")'>View Details</a></div></div>  
  6.            }  
MVC4-View(视图)




MVC4-View(视图)


二:常用方法

@Html.Raw()输出html,如果直接写<br/>不会被作为换行解析,而是直接变成字符串了,要使用该标签



三:html标签里边使用@代码

MVC4-View(视图)

如果[email protected]是不行的会被当字符串解析了


相关文章: