Sunday 24 November 2013

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

Leave a Comment

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 =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.