[Solved] x == y ? “1” : “5” How to use?


I think your main issue is that you’re always passing the disabled attribute. You shouldn’t pass this attribute if you want the radio button to be enabled.

<label><%: Html.RadioButtonFor(model => model.UserInfo.DeliveryCode, "1" , Model.ChargeREFCode == "5" ? (object)new { id = "DC1" , disabled = "disabled" } : new { id = "DC1" })%>受信する</label>

Regarding the title:

Well x == y checks if x is y, ? is ternary operator which sort of acts like an if. So if x is y then return “1” else return “5”

0

solved x == y ? “1” : “5” How to use?