3

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 Answers 4

5

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.

2

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 ( <%= %> ).

2

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.

0

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.

1
  • 1
    His question specifically says he's not asking which one is better. He's asking what the syntax differences are.
    – jlembke
    May 18, 2009 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.