MVC4 dhtmlXGrid Uncaught IndexSizeError


I’m using dhtmlXGrid in Visual Studio 2013, MVC4.
I followed this tutorial but stock in “Filling Grid with Data”.


When I open in IE, it doesn’t show an error.

But the Chrome does.
Uncaught IndexSizeError: Failed to execute ‘insertRow’ on ‘HTMLTableElement’: The index provided (2) is greater than the number of rows in the table (1).

I wrote code as below.

[code]@{ViewBag.Title = “Home Page”;}

var grid = new dhtmlXGridObject(“grid_here”);
grid.setHeader(“Author, Title”);

	grid.load("/Admin/Data?=" + grid.uid());//added !


[code]@model IEnumerable<MVCBooks.Models.Books>

//List<MVCBooks.Models.Books> books = ()
Response.ContentType = “text/xml”;

@foreach (var book in Model){


Yes, tutorial and my code is different. But other way doesn’t show even grid. If my method is wrong, please give me please help me to correct it :slight_smile: I will attach my file.

I struggled to solve this problem almost one week…
Finally I solved.

I am new MVC and dhtmlXGrid, so it was difficult to understand concept and basic route.
I will post it for like me beginners.

I made another file MVC4, and used View .aspx file.
I didn’t know MVC4 has .aspx View file so keep using cshtml file. But now I found select menu Razor or C# file of View when make View file at the first step.

So, View folder -> Add -> View -> Type View name, select View Engine ASPX(C#) , unchecked using layout or master page.

After select collect things, works greatly. :slight_smile: