如果Model.Promotion.PromotionID为10,我想有条件地禁用此按钮或隐藏它。不确定如何操作。 我试图找到解决方案,但努力解决它。
非常感谢帮助谢谢
@using (Html.BeginForm("Edit", "Promotion", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.Promotion.PromotionID)
@Html.HiddenFor(model => model.Promotion.Active)
<fieldset class="fieldset">
<legend class="legend">Edit Promotion</legend>
<div>
<div class="editor-field" title="The name of the Promotion" @((Model.Promotion.PromotionID == 209) ? "disabled" : "")>
@Html.EditorFor(model => model.Promotion.PromotionTitle )
@Html.ValidationMessageFor(model => model.Promotion.PromotionTitle)
</div>
</div>