Click here to Skip to main content
15,499,155 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a problem about use Grid.mvc in Partial View. When I use grid.mvc in View, it working normal but when I use in partial view, grid.mvc can't paging, filter... Have any idea? Thanks you very much! This is my code:

What I have tried:

<pre lang="HTML">
<!-- Index.html -->
ViewBag.Title = "ABC";
Layout = "~/Views/Shared/_Layout.cshtml";
<div class="row">
<div class="col-xs-9 col-lg-10">
<div class="box box-primary">
<div class="box-header with-border"></div>
<div class="box box-body">
<div class="row">
<div class="col-xs-12 col-lg-12">
<div id="products"></div>

$(function() {
url: '@Url.Action("GetProducts", "Equipment")',
dataType: "html",
type: "GET",
cache: false,
contentType: 'application/html; charset=utf-8',
success: function (data) {
error: function (xhr) {

<!--Partial view-->

@using GridMvc.Html

&lt;script src="@Url.Content("~/Content/Scripts/gridmvc.min.js")">&lt;/script>
&lt;script src="@Url.Content("~/Content/Scripts/jquery-1.10.2.min.js")">&lt;/script>
@Html.Grid((IEnumerable<Model.ViewModels.EquipmentModel>)ViewBag.ListEquipment).Named("ast").Columns(columns =>
columns.Add(c => c.Serial_No).Titled("Số serial").Filterable(true).SetWidth(100).Sortable(true);
columns.Add(c => c.Name).Titled("Tên thiết bị").Filterable(true).SetWidth(250).Sortable(true);
&lt;script src="~/Content/Scripts/gridmvc.js">&lt;/script>

<!-- Controller -->

public class EquipmentController : BaseController
string strError = "";

// GET: Equipment
public ActionResult Index()
return View();

public ActionResult GetProducts(string ID)
var model = getEquipmentByID(Convert.ToInt16(ID)); //Get data
ViewBag.ListEquipment = model;
return PartialView("GetProducts", model);
Updated 4-Oct-17 13:24pm

1 solution

/* Refresh the grid, once it is placed in the div */
Share this answer
Member 14542576 26-Jul-19 15:02pm     CRLF
It does not work. I have used like below. success: function (data) { $('#dvData').html(data); $(".grid-mvc").gridmvc(); = "block";

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