Reputation: 5670
I have a checkbox like this
<input type="checkbox" doublecheck="@item.isReusable">
and the item.isReusable
is a bool field. Value inside it is either True or false. But when the HTML gets rendered I always get the result like this
<input type="checkbox" doublecheck="doublecheck">
What can be the reason I am unable to set True/False as the value of my custom attribute doublecheck
? And how can I solve this issue?
Upvotes: 0
Views: 53
Reputation: 18159
You can try to use HtmlHelper
,here is a demo:
Model:
public class TestModel
{
public bool isReusable { get; set; } = true;
}
View:
@Html.CheckBox("checkbox1", new { doublecheck = Model.isReusable ,value=false})
Upvotes: 0