У меня есть этот шаблон шаблона:
@model MyNamespace.Models.SomeModel
@using HtmlHelpers.BeginCollectionItem
<div>
@using (Html.BeginCollectionItem("someProperty")) {
<div class="form-group">
@Html.LabelFor(m => m.field1, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.field1, new { @class = "form-control" })
</div>
</div>
//more content here
}
</div>
Мне нужно условно включить @using (Html.BeginCollectionItem("someProperty")) {}
часть в зависимости от значения ViewBag.
Возможно ли это?