开发者

Ajax.ActionLink not working MVC

开发者 https://www.devze.com 2023-03-20 12:59 出处:网络
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.

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(); %&开发者_开发问答gt;

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


Replaced ReportsController with Reports (controller name without Controller) in Ajax.ActionLink, and it worked

0

精彩评论

暂无评论...
验证码 换一张
取 消