在我的网页中,我需要根据调用的参数值填充按钮ButtonType
。
假设如果ButtonType == "Edit"
那么我需要隐藏每个按钮,但是butUpdate
.
我想知道如何通过 MVC Action 方法显示/隐藏 html 按钮。
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SupplierDetail(int SupplierID, string ButtonType)
{
var Supplier = supplierListRepository.Supplier_SelectByID(SupplierID);
return View(Supplier);
}
我正在使用 Asp.net Mvc Razor 表单。
@using (Html.BeginForm("SupplierDetail_SubmitClick", "Supplier", FormMethod.Post, new { id = "frmSupplierDetail" }))
{
@Html.ValidationSummary(true)
<table cellpadding="0" cellspacing="0" border="0" style="width:450px; height:auto">
.....
<tr>
<td>@Html.LabelFor(model => model.Phone)</td>
<td>@Html.EditorFor(model => model.Phone)
@Html.ValidationMessageFor(model => model.Phone)</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" id="butSave" name="butSave" value="Save" style="width:100px; height:auto" />
<input type="submit" id="butUpdate" name="butUpdate" value="Update" style="width:100px; height:auto" />
<input type="submit" id="butDelete" name="butDelete" value="Delete" style="width:100px; height:auto" />
<input type="submit" id="butReset" name="butReset" value="Reset" style="width:100px; height:auto" />
</td>
</tr>
</table>
</div>
<div id="content">
@Html.ActionLink("Back to List", "Index")
</div>
}
每个建议将不胜感激。