在CSHTML个标签 [英] percentage tags in cshtml
本文介绍了在CSHTML个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一起在MVC教程之后,你就告诉我可以替代的一个ASPX页面
Following along on a tutorial in MVC, would you tell me the alternative to this in a ASPX page
<div>
<%=ViewData["CurrentTime"]%>
</div>
在 CSHTML 页,默认视图在MVC 4 VS2013类型。当我尝试以上,则显示的字面含义。即计算机[CURRENTTIME]
而不是价值DateTime.now
In a cshtml page, the default view type in MVC 4 on VS2013. When I try the above, the literal meaning is displayed. i.e. ViewData["CurrentTime"]
instead of the value DateTime.now
推荐答案
当您使用 CSHTML
。您正在使用剃刀发动机的工作。
When you using a cshtml
. You are working with Razor engine.
在剃刀引擎,你需要使用 @
像
In Razor engine, You need to use @
like
@ViewData["CurrentTime"]
&LT;%=计算机[CURRENTTIME]%GT;
是一个ASP.Net引擎code
<%=ViewData["CurrentTime"]%>
is a ASP.Net engine code
这篇关于在CSHTML个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文