[英]MVC 3 without using Razor?
Is the Razor engine really needed to create an MVC3 site with EditorFor syntax? Razor引擎真的需要使用EditorFor语法创建MVC3站点吗? Almost all the examples I've seen are using Razor. 我见过的几乎所有例子都在使用Razor。 Were working on our first MVC project, and would rather not be on the bleeding edge ... 正在开展我们的第一个MVC项目,而不是处于最前沿......
The short answer is "no", you don't have to use Razor. 简短的回答是“不”,你不必使用Razor。 IMHO you should really reconsider moving away from the ASPX view engine. 恕我直言,你应该重新考虑远离ASPX视图引擎。 Razor is a very stable platform for generating HTML. Razor是一个非常稳定的HTML生成平台。
I agree with everyone here. 我同意大家的意见。 -10,000 for wanting to use aspx syntax : ) -10,000想要使用aspx语法:)
Go for razor.. it will take you 2 minutes to learn. 去剃须刀..你需要2分钟的学习时间。 See the syntax reference at: 请参阅以下语法参考:
http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx
Just remember that @Something expects output and will HtmlEncode it for you (which is a huge +++) but that @{ some other code} does not render output to the stream. 请记住@Something需要输出并将HtmlEncode为你(这是一个巨大的+++),但@ {其他一些代码}不会将输出呈现给流。 So @Html.TextBoxFor() works great but @{Html.TextBoxFor())} I believe won't emit anything and you'll be wondering why there is no output. 所以@ Html.TextBoxFor()工作得很好,但@ {Html.TextBoxFor())}我相信不会发出任何东西,你会想知道为什么没有输出。 Other than those gotchas.. its awesome and you will never ever want to go back to aspx again. 除了那些陷阱...它真棒 ,你永远不会再想回到aspx。 Seriously.. you will pick it up in no time. 说真的..你马上就会把它捡起来。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.