Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Part 30 - View engines in asp.net mvc

Suggested Videos 
Part 27 - Customizing the auto-generated create view
Part 28 - Customizing the auto-generated edit view
Part 29 - Using data transfer object as the model in mvc



In this video we will discuss, different view engines that are available in asp.net mvc. Please watch Part 29, before proceeding. 

Out of the box asp.net offers the following 2 view engines.
1. ASPX
2. Razor



There are 3 possible interview questions here, to test your understanding of view engines.
1. What is the difference between RAZOR and ASPX view engines?
It mostly, boils down to the syntax. Otherwise there are no major differences between the two. In ASPX view engine, the server side script is wrapped between <% %>, where as in RAZOR we use @. Personally, I prefer using RAZOR views, as it is very easy to switch between HTML and Code. 

Depending on the programming language you have chosen, RAZOR views have the extension of .CSHTML or .VBHTML, where as ASPX views has the extension of .ASPX

2. Is it possible, to have both RAZOR and ASPX views in one application?
Yes, when you right click on any controller action method, and select "Add View" from the context menu, you will have the option to choose the view engine of your choice from the "Add View" dialog box.

3. Is it possible, to use a third party view engine with asp.net mvc?
ASP.NET MVC is designed with extensibility in mind. So, it's very easy to include third party view engine as well. We will discuss this in detail in our next video.

5 comments:

  1. Thanks for your tutorials! It's very nice what you did, working in IT area is great, we all have all resources we need to start learning for free.

    ReplyDelete
  2. Hi
    Thanks for your great tutorials

    I can't Add ASPX view page based on MVC 5

    Is it allowed to add ASPX view in MVC 5 and how ?

    ReplyDelete
  3. I am not able to Add ASPX view page based on MVC 5 and VisualStudio 2019

    Is it possible to add ASPX view in MVC 5?

    ReplyDelete

It would be great if you can help share these free resources