The extension method EditorForconnects your model to PartialView, which is located in the EditorTemplates file, which corresponds to the type of model (therefore, in this case it should be Boolean.cshtml).
, . , MoreInstructorsAllowed, EditorFor additionalViewData .
, , . , , . :
public class InstructorProperty {
public bool IsInstructor { get; set; }
public bool MoreInstructorsAllowed { get; set; }
}
/Shared/EditorTemplates/InstructorProperty.cshtml
@model InstructorProperty
, CheckboxFor "disabled", EditorFor ad hoc html. , ModelMetadataProvider , ModelMetadataProvider. : http://aspadvice.com/blogs/kiran/archive/2009/11/29/Adding-html-attributes -support-for-Templates-2D00-ASP.Net-MVC-2.0-Beta_2D00_1.aspx. , : (1) html CheckboxFor , (2) CheckboxFor InstructorProperty (3) - html InstructorProperty. , , InstructorProperty :
@Html.CheckboxFor(_=>_.IsInstructor,
htmlAttributes: (Model.MoreInstructorsAllowed ? null : new { disabled = "disabled"} ).ToString().ToLowerInvariant() });
, ... . Checkbox , , Mvc Framework , html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(htmlFieldName)