How to use ternary operator in razor view?
问题 I am using MVC 4 razor view . here i want to disable the textboxfor if the "ERAGOGType" is "None" else if the value is not "None" then enable it My view razor code @{ if ((Model.ERAGOGType == "None")) { @Html.LabelFor(model => model.ERAGOGCode) @Html.TextBoxFor(model => model.ERAGOGCode, new { @disabled = true }) } else { @Html.LabelFor(model => model.ERAGOGCode) @Html.TextBoxFor(model => model.ERAGOGCode) }} How can i achieve this by using a ternary operator ? plz help Thanks in advance 回答1: