Possible Duplicate:
How to use ternary operator in razor (specifically on HTML attributes)?
I am trying to do the following but its erroring so I'm obviously doing something wrong with the Razor syntax:
<td>@{item.Licence.MachineId != null ? @:"TB Master" : @:"HandHeld"} </td>
The following should work:
<td>@(item.Licence.MachineId != null ? "TB Master" : "HandHeld")</td>
Try this
<td>@(item.Licence.MachineId != null ? "TB Master" : "HandHeld")</td>
精彩评论