当我点击参考时,我想隐藏表格的一行。
我尝试过这样的事情:
{
<tr id="trHide1" runat="server">
<td>@Ajax.ActionLink(r.Jmeno.ToString(), "Detail", new { id = r.Jmeno }, new AjaxOptions() { UpdateTargetId = "modalContent", InsertionMode = InsertionMode.Replace, OnBegin = "openModalWindow" }), @r.Prijmeni</td>
<td>@r.Rez_kolobezky.Reg_cislo</td>
<td>@r.Datum_od</td>
<td>@r.Datum_do</td>
<td>@Html.ActionLink("OK", "Schovej", "Dnes", new { id = r.Id }, new
{ onclick = "trHide1=false"})</td>
</tr>
}
和控制器中的方法如下所示:
public ActionResult Schovej(int id)
{
try
{
Rezervace_dao rd = new Rezervace_dao();
Rezervace r = rd.GetById(id);
//var trHide1 = false;
TempData["message-success"] = "Koloběžka byla odevzdaná";
}
catch (Exception)
{
throw;
}
return RedirectToAction("Index", "Dnes");
}
答案 0 :(得分:0)
其中一个解决方案是:
{
<td @((!r.ShowRow) ? "style='display:none'" : string.Empty)>@r.Datum_do</td>
}