Click here to Skip to main content
16,012,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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(); %>
<br />
<div id="StatusBatchDetailsDiv">

</div>


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
Posted

1 solution

Is your controller name "ReportsController"? If yes, then try replacing the name of controller from "ReportsController" to "Reports" in above HTML grid code.

This should solve the issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900