json and partial view

Sep 10, 2014 at 8:26 PM
Hello I am having trouble rendering a second partial view using json. I have been using the grid.mvc source code as my guide and my issue is as follows

1) I open my main view called /Admin/ there using grid view I display a list of customers. When selecting a row, the customer accounts are displayed in a partial view on the right. This works fine.

    public JsonResult GetCustomer(int id)
        // stored procedures
        var allAccounts = bk.GetAccounts();

        List<Account> accounts = new List<Account>();

        foreach (var acc in allAccounts)
            if (id == acc.CustomerID)
                accounts.Add(new Account(acc.AccountNumber, acc.AccountType, acc.CustomerName, acc.CustomerID, acc.AccountBalance));

        if (accounts == null)
            return Json(new { Status = 0, Message = "Not found" });

        return Json(new { Status = 1, Message = "Ok", Content = RenderPartialViewToString("_CustomerInfo", accounts) });
ViewBag.Title = "Customers";
<h2>Customers</h2> <div class="row"> <div class="col-md-3 col-md-push-9"> <h2 class="center"> Account Details </h2> <div id="account-content"> <p class="muted"> Select customer to display detailed infomation </p> </div> </div> <div class="col-md-9 col-md-pull-3"> @Html.Action("Grid") </div> </div> <script type="text/javascript"> $(function () { pageGrids.customersGrid.addFilterWidget(new CustomersFilterWidget()); pageGrids.customersGrid.onRowSelect(function (e) { $.post("/Admin/GetCustomer?id=" + e.row.CustomerID, function (data) { if (data.Status <= 0) { alert(data.Message); return; } $("#account-content").html(data.Content); }); }); }); </script> 2) Now the user can select an account in that partial view, which open up a new view /Admin/History/1004 for example. 1004 being the account number. On the page is a grid view of all transactions for the account.
The problem is when clicking on the row, I now can not get a partial view to appear (as before) displaying the transaction details. The place holder text
<p class="muted"> Select customer to display detailed information </p> disappears, but I can't get the data to display. I think it might have something to do with routes, but I am not really sure. Any suggestions are most welcome,
Sep 11, 2014 at 12:42 AM
I actually solved my problem, it was as simple as not matching the correct transaction id