当我点击编辑按钮时,我想要隐藏网址
我尝试使用@Html.ActionLink
,但我有这样的结果
http://localhost:57098/Home/Edit/1
我需要这个结果:http://localhost:57098/Home/Edit
。
我也尝试通过input
,但是当我点击输入按钮时 - 我的效果为零
请帮我找错,并妥善提出要求
我的控制器
[Authorize]
public ActionResult Index()
{
IEnumerable<LPU> lpuv = kz.LPUs.Where(x => x.Code == HttpContext.User.Identity.Name).ToList();
return View(lpuv);
}
[Authorize]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Index(LPU lpusi)
{
return RedirectToAction("Edit", "Home" , new { ogrn = lpusi.M_NAMES });
}
[Authorize]
[HttpGet]
public ActionResult Edit(string ogrn)
{
var lpue = kz.LPUs.Where(x => x.C_OGRN.Contains(ogrn)).FirstOrDefault();
return View(lpue);
}
我的观点:
@model IEnumerable<LpuList.Models.LPU>
...
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.M_NAMES)
</th>
<th>
@Html.DisplayNameFor(model => model.FAM_GV)
</th>
<th>
@Html.DisplayNameFor(model => model.TEL)
</th>
<th>
@Html.DisplayNameFor(model => model.FAX)
</th>
<th>
@Html.DisplayNameFor(model => model.E_MAIL)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.M_NAMES)
</td>
<td>
@Html.DisplayFor(modelItem => item.FAM_GV)
</td>
<td>
@Html.DisplayFor(modelItem => item.TEL)
</td>
<td>
@Html.DisplayFor(modelItem => item.FAX)
</td>
<td>
@Html.DisplayFor(modelItem => item.E_MAIL)
</td>
<td>
<input type="submit" value="Submit" formaction=@Url.Action("Index") formmethod="post">
@Html.ActionLink("Изменить", "Edit", new { ogrn = item.M_NAMES }, new { @class = "btn btn-primary btn-large" })
</td>
</tr>
}
</table>
...