views:

196

answers:

4

Hello!

Now this isn't a question as to which of the technologies is better, since they both have their relevant uses for different scenarios.

My question is regarding the syntax of the two. How do their syntax's differ?

+4  A: 

ASP.NET MVC (as the name suggests) is still ASP.NET. It just adds an extra layer that implements the Model-View-Controller method. Views are just plain old ASPX pages, controllers are just plain old C#/VB.NET classes that inherit from a Controller class. The only major difference (aside from the whole MVC way of thinking, of course) is that code-behind files aren't used by default. You can still create them yourself, though.

David Brown
+2  A: 

The syntax is pretty much the same. You are still writing C# or VB code. The only difference is you have no code-behind, as it's separated into the controllers. Your views may contain some logic in them, in the form of ASP tags ( <%= %> ).

Matt Andreko
+2  A: 

MVC and Webforms use different HttpHandlers in order to expose programmatic features to developers to handle requests.

MVC gives you much greater control over the html that you put on the page (as you will write almost all of it), whereas Webforms (aka ASP.Net) will render Html to the page automatically.

Both use the same syntax, but you don't have access to server controls in MVC (e.g. <asp:DataGrid />) which can save you time with features such as databinding, at the cost of having html that looks a little like vomit.

You will also find that you won't need special cases in your page lifecycle events (as that doesn't exist in MVC) to stop things from firing when you handle an event.

Khanzor
A: 

There is no better things both are having pros and cons of their own. Its depends on your need that how you want to develope this application. Both are having its advantage or disadvantage.

jalpesh
His question specifically says he's not asking which one is better. He's asking what the syntax differences are.
jlembke