@Html.ActionLink("LotNumberDetails", "Index", "LotNumber", new { id = item.lotNUmber }, null)
这是我在表格中的操作链接,当我单击 LotNumber ActionLink 时,它会生成以下 URL:
http://servername.com/LotNumber/Index/1111_100868781211
控制器中的方法如下:
[HttpGet]
public ActionResult Index(string id)
{
var TupleResult = objLotNumberModel.GetLotNumberValuesEnumerable(id);
return View("Index", TupleResult);
}
一切正常,但是当我将 ActionLink 更改为 Ajax.ActionLink ...
@Ajax.ActionLink("LotNumber", "Index", "LotNumber", new { id = item.lotNUmber }, new AjaxOptions { HttpMethod = "POST"})
和控制器方法...
[HttpPost]
public ActionResult Index(string id)
{
var TupleResult = objLotNumberModel.GetLotNumberValuesEnumerable(id);
return View("Index", TupleResult);
}
该方法正在触发,但我无法移动到相应的页面。
我的想法是隐藏 LotNumber 的 ID,即在单击 ActionLink 时,我只想获取像“ http://servername.com/LotNumber/Index ”这样的 URL。