I thinks my question will be best understood with the example below.
public Class1
{
public bool SomeProperty1 {get;set;}
public string SomeProperty2 {get;set;}
}
public Class2
{
//bool property in which i want to use the checkboxfor
public List<Class1> SomeProperty3 {get;set;}
public string SomeProperty4 {get;set;}
}
@model Class2
@Html.Textboxfor(SomeProperty4)...
.
.
.
@foreach(var x in SomeProperty3)
{
<td>Html.Checkboxfor(model=>x.SomeProperty1...) </td>
//How?
}
I also cant figure out how to add a disabled property to the html element.
您可以使用html属性,如下所示。
Html.Checkboxfor(model=>x.SomeProperty1,new {@disabled="diasbled"})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.