Razor语法快速参考
来源:互联网 发布:网络课程好吗 编辑:程序博客网 时间:2024/05/14 15:28
@{ int x = 123; string y = "because.";}
<% int x = 123; string y ="because."; %>表达式(Html Encoded)
<span>@model.Message</span>
<span><%: model.Message %></span>
表达式(Unencoded)<span>@Html.Raw(model.Message)</span>
<span><%= model.Message %></span>
组合文本和标记@foreach(var item in items) {<span>@item.Prop</span> }
<% foreach(var item in items) { %><span><%: item.Prop %></span> <% }%>混合代码和纯文本
@if (foo) { <text>Plain Text</text> }
<% if (foo) { %> Plain Text <% } %>混合代码和纯文本 (备选)
@if (foo) { @:Plain Text is @bar }同上电子邮件地址
Hi philha@example.com
Razor 能认出基本的电子邮件格式,不会把 @ 当作代码分界符显式表达式<span>ISBN@(isbnNumber)</span>
这种情况下,需要对表达式使用圆括号取消转义 @ 符号<span>In Razor, you use the @@foo to display the value of foo</span>@@ 表示 @混合表达式和文本
Hello @title. @name.
Hello <%: title %>. <%: name %>.
服务器端注释@* This is a server side multiline comment *@
<%-- This is a server side multiline comment --%>
0 0
- Razor语法快速参考
- Razor语法快速参考
- 【MVC】C# Razor 语法快速查询
- Wiki语法快速参考
- Wiki语法快速参考
- Razor语法
- Razor语法
- Razor语法
- Razor语法
- Razor 语法
- Razor语法~
- Razor 语法
- Objective-C语法快速参考
- Objective-C语法快速参考
- Objective-C语法快速参考
- Objective-C语法快速参考
- Objective-C语法快速参考
- Objective-C语法快速参考
- failed to obtain a cell from its dataSource
- Spring注解@Component、@Repository、@Service、@Controller区别
- Spring AOP基础知识学习——XML配置
- ubuntu14.04 内核版本4.2下解决vmware安装Virtual ethernet [Failed]的情况记录
- SDL2缩放窗口in MFC
- Razor语法快速参考
- EAGAIN、EWOULDBLOCK、EINTR与非阻塞
- Android中逐帧动画的实现
- 公司项目问题解决
- sql查询7天内的数据
- sql server 计算两个经纬度点之间的距离
- MJRefresh 部分应用
- 百度地图鹰眼
- python 2.x中对象比较大小