MVC4-View(视图)

来源:互联网 发布:网易是什么软件 编辑:程序博客网 时间:2024/06/04 23:18


一:集合与普通对象

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






二:常用方法

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



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


如果table@item.Id是不行的会被当字符串解析了





1 0
原创粉丝点击