How to perform if conditional operation in view?
@if (fileName == "itfunda") { <p>The file name is not ITFunda</p> } else { <p>Sorry, it is DotNetFunda</p> }
Notice that @ character is just before the first line of the conditional statement, else doesn’t have @ as the Razor markup automatically detects the starting and ending if block and assumes that else is the part of if not the HTML syntax.
No comments:
Post a Comment