Articles → ASP .NET MVC → View Engines In Asp.Net MVC

View Engines In Asp.Net MVC







  1. ASPX view engine
  2. Razor view engine.

ASPX view engine




  1. Extension of all your files in view folder is .aspx
  2. Picture showing view files in case of aspx view engine

    Click to Enlarge

  3. < % % > is used for accessing server-side code
  4. <p><% 
                
                
                if (DateTime.Now.Day == 19)
                
                
                
                   {%>
                   
                
                Execute code block 1
                
                
                <%}else {%>
                
                
                Execute code block 2
                
                <%} %>
    </p>



Razor view engine




  1. Extension of all your files in view folder is .cshtml for C# and .vbhtml for vb.net.
  2. Picture showing view files in case of razor view engine

    Click to Enlarge

  3. @ is used for accessing server-side code.
  4. <p>
            Use this area to provide additional information.
            @if (DateTime.Now.Day == 19)
            {         
    	    <text>  Execute Code block 1</text>            
            }
            else
            {
        
    	    <text>Execute Code block 2</text>
            }
    </p>



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, June 9, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250