MVC 3 without using Razor?
Asked Answered
C

3

6

Is the Razor engine really needed to create an 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 ...

Cherri answered 23/6, 2011 at 16:3 Comment(0)
W
6

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.

New View

Womanish answered 23/6, 2011 at 16:4 Comment(8)
+1, and I agree it's completely insensible to not use Razor on a new project (or an old project, for that matter).Putupon
@Kirk: There is definitely a learning curve, but it isn't very steep. In my experience I find that Razor is much more intuitive.Womanish
@Yuck, true, but the OP didn't claim to have .ASPX view-engine experience either. Only a desire not to be using "bleeding edge" APIs, which I stress is an inadvisable rationale for not using Razor.Putupon
@Yuck, I've used the aspx engine, just not razor ... and if it, razor, was that much better wouldn't it be the default view engine when creating a new project? So I can assume that everything that can be done in razor can be done in aspx? And thanks for the help people ...Cherri
seriously - using the aspx syntax will GRATE you after a short while - Razor is already stable and is so much better a developer experience.Youngling
@Greg: It's a different syntax for the most part. For one thing, the way Razor handles partial views is much cleaner (and safer) in my opinion.Womanish
@Greg, judging the quality of an API based on what MS sets as the default would likely lead you to assume that VB.NET is the best since MSDN always defaults to that language. :)Putupon
@Kirk ... looks like I'm going to start using Razor then :)Cherri
C
1

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

Colunga answered 23/6, 2011 at 16:34 Comment(0)
T
0

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.

Tagalog answered 23/6, 2011 at 19:35 Comment(1)
razor syntax was spawn from an html hater. Besides, razor ends up pre-compiling to aspx anywaysRarefied

© 2022 - 2024 — McMap. All rights reserved.