SCRIPT5007: Unable to get value of the property '0': object is null or undefined - jquery.jqGrid.js


If you try to create data grid using mvc jqGrid and somehow the error above occur while debugging script using IE Debugger. Please follow this step to fix it..

The error because of in your mvc jqGrid coding, you not specify the json reader.
Just add this line of code in your View and also in your mvc jqGrid .

The Solution

@{
                MvcJqGrid.DataReaders.JsonReader jsonReader = new MvcJqGrid.DataReaders.JsonReader();
                jsonReader.RepeatItems = false;
                jsonReader.Id = "dataJson";
            }

@(Html.Grid("GridDataBasic")
                .SetCaption("List Of User")
                .AddColumn(new Column("AdminID"))
                .AddColumn(new Column("Email"))
                .AddColumn(new Column("Tel"))
                .AddColumn(new Column("Role"))
                .AddColumn(new Column("Active"))
                .SetUrl("/Home/GridDataBasic")
                .SetAutoEncode(true)
                .SetDataType(MvcJqGrid.Enums.DataType.Json)
                .SetAutoWidth(false)
                .SetWidth(650)
                .SetRowNum(10)
                .SetJsonReader(jsonReader)
                .SetLoadUi(MvcJqGrid.Enums.LoadUi.Block)
                .SetRowList(new int[] { 10, 15, 20, 50 })
                .SetViewRecords(true)
                .SetGridView(true)
                .SetEmptyRecords("No record Found")
                .SetShowAllSortIcons(true)
                .SetShrinkToFit(true)            
                .SetPager("pager"))

By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

Popular posts from this blog

Example to disable save as certain file type in SSRS Report Viewer

How to create DataGrid or GridView in JSP - Servlet

Control Webpart Visible/Enable using macro in Kentico