我用这个:
<input type="checkbox" value="@item.Id" checked="@(item.HasAccess ? "checked" : "")"/>
This worked correctly: I mean when HasAccess
is true
then checked="checked"
and when
HasAccess
is false
then checked=""
but always the checkbox
s checked, how can I use ternary operator and handle checked
attribute correctly?