I commonly use the ternary operator for very simple conditionals, especially within HTML attributes. For example:

<fieldset id="Employee" style="@(Model.Type == "Employee" ? "" : "display: none")" >

But I'm looking to have a multiple ternary operator something like this but the below does not work:

<fieldset id="multi" 
   style="@(Model.Type == "W2" || 
            Model.Type == "1099" ? "" : "display: none")" >

Related posts

Recent Viewed