开发者

MVC 3 without using Razor?

开发者 https://www.devze.com 2023-03-15 10:59 出处:网络
Is the Razor engine really needed to create a开发者_开发问答n MVC3 site with EditorFor syntax? Almost all the examples I\'ve seen are using Razor.Were working on our first MVC project, and would rathe

Is the Razor engine really needed to create a开发者_开发问答n MVC3 site with EditorFor syntax? Almost all the examples I've seen are using Razor. Were working on our first MVC project, and would rather not be on the bleeding edge ...


The short answer is "no", you don't have to use Razor. IMHO you should really reconsider moving away from the ASPX view engine. Razor is a very stable platform for generating HTML.

MVC 3 without using Razor?


You can use webform viewengine also. if you want to convert view from razor to webform you can find vs extension here. Also telerik has a tool to convert it you can find it here on telerik site


I agree with everyone here. -10,000 for wanting to use aspx syntax : )
Go for razor.. it will take you 2 minutes to learn. See the syntax reference at:

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. So @Html.TextBoxFor() works great but @{Html.TextBoxFor())} I believe won't emit anything and you'll be wondering why there is no output. Other than those gotchas.. its awesome and you will never ever want to go back to aspx again. Seriously.. you will pick it up in no time.

0

精彩评论

暂无评论...
验证码 换一张
取 消