有一个代码:
@{ string tempClass = ViewBag.IsCreate ? "enabled" : " disabled";}
<div class="text-primary h3 text-left col-2 pl-0">Скидка</div>
@Html.DropDownListFor(m => m.GroupDiscount, new SelectList(GroupsDiscount, "Key", "Value"), htmlAttributes: new { @class = "form-control selectedDiscountGroup col-md-10", @disabled=tempClass })
if = true如何ViewBag.IsCreate
删除该属性disabled
?否则没有任何效果
1 个回答