ASP.NET MVC > Views - Razor Engine

Switch case conditional operator in ASP.NET MVC

How to perform switch case conditional operation in view?

It is similar to if, we just need to write switch statement. Notice how beautifully we are able to mix the C# and HTML code. 

@switch (fileName) 
case "itfunda":
<p>itfunda logo</p>
case "dotnetfunda":
<p>dotnetfunda logo</p>
default :
<p>no logo</p>
 Views: 25985 | Post Order: 14

Write for us

Hosting Recommendations