Ajax.ActionLink 不工作 MVC
我有一个网格,我需要将详细信息列添加到网格中,当选择详细信息列时,该行的详细信息应显示在当前网格的正下方。
我的代码:
<% Html.Grid(Model.InnerModel.StatusRecords)
.Empty("No data available")
.Attributes(new Hash(id => "resultsTable"))
.Columns(column =>
{
column.For(x => Ajax.ActionLink("Details", "BatchDetailsByStatus", "ReportsController", new { statusId = x.Status, jobNo = Model.InnerModel.JobNumber }, new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "StatusBatchDetailsDiv"})).Named("Details").DoNotEncode();
column.For(x => x.Status);
column.For(x => x.TotalCount).Named("Count");
}).Render(); %>
我的控制器代码:
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult BatchDetailsByStatus(int statusId, string jobNo)
{
var batchModel = BatchByStatus.GetBatchDetailsByStatus(statusId, jobNo);
return PartialView("BatchDetailsByStatus", batchModel);
}
我有一个partailview BatchDetailsByStatus,它获取要显示的所有必需数据。
但是,当我单击“详细信息”链接时,没有任何反应,它不起作用。
我错过了什么。
谢谢
I have a grid, I need to add Details column to the grid and when the detail column is selected the details for that row should appear just below the current grid.
My Code :
<% Html.Grid(Model.InnerModel.StatusRecords)
.Empty("No data available")
.Attributes(new Hash(id => "resultsTable"))
.Columns(column =>
{
column.For(x => Ajax.ActionLink("Details", "BatchDetailsByStatus", "ReportsController", new { statusId = x.Status, jobNo = Model.InnerModel.JobNumber }, new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "StatusBatchDetailsDiv"})).Named("Details").DoNotEncode();
column.For(x => x.Status);
column.For(x => x.TotalCount).Named("Count");
}).Render(); %>
My Controller code:
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult BatchDetailsByStatus(int statusId, string jobNo)
{
var batchModel = BatchByStatus.GetBatchDetailsByStatus(statusId, jobNo);
return PartialView("BatchDetailsByStatus", batchModel);
}
I have a partailview BatchDetailsByStatus that gets all the required data to display.
But when I click on the Details link nothing happens, it does not work.
What am I missing out.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Ajax.ActionLink 中将 ReportsController 替换为 Reports(控制器名称不带 Controller),并且它有效
Replaced ReportsController with Reports (controller name without Controller) in Ajax.ActionLink, and it worked