checked ( ), . HTML5. , checked, .
RadioButtonFor, checked htmlAttributes. - :
public static MvcHtmlString RadioButtonFor<TModel, TValue>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TValue>> expression, object value, object htmlAttributes, bool checkedState)
{
var htmlAttributeDictionary = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
if (checkedState)
{
htmlAttributeDictionary.Add("checked", "checked");
}
return htmlHelper.RadioButtonFor(expression, value, htmlAttributeDictionary);
}
( , , ) :
@foreach (var item in Model.Entities)
{
<div>
@Html.RadioButtonFor(m => item.Default, item.EntityId, new { }, item.Default)
</div>
}