Home > database >  how to use IIF in a Razor page?
how to use IIF in a Razor page?

Time:06-08

I use ASP MVC NET6 (Razor page). how to use IIF?, like the following:

<li >
   <span >Is Supervisor:</span>
   <span >(@Model.isSupervisor ? 'YES' : 'NO')</span>
</li>

CodePudding user response:

You needs to move @ outside ().Try to use the following code:

<span >@(Model.isSupervisor ? "YES":"NO")</span>
  • Related