Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying Jqgrid using web api in mvc4. i have proper libraries for jquery and jqgrid. but still on loading of view page it raise error as "Object doesn't support property or method 'jqGrid'"

Following is the code for that. It will be help if i get solution for this.

Razor
@{
    ViewBag.Title = "Index";
}
<html>
<head>
    <link href="../../Scripts/ui.jqgrid.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/JQGrid/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/JQGrid/jquery.jqGrid.min.js" type="text/javascript"></script>
    <script src="../../Scripts/JQGrid/grid.locale-en.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#tblJQGrid").jqGrid(
                {
                    url: 'api/Values',
                    datatype: "json",
                    mtype: 'GET',
                    colNames: ['ProductID', 'ProductName', 'ProductCategory', 'Price'],
                    colModel: [
                                { name: 'ProductID', index: 'ProductID', width: 20, stype: 'text' },
                                { name: 'ProductName', index: 'ProductName', width: 150 },
                                { name: 'ProductCategory', index: 'ProductCategory', width: 80, align: "right" },
                                { name: 'Price', index: 'Price', width: 80, align: "right" }
                              ],
                    rowNum: 10,
                    sortname: 'ProductID',
                    viewrecords: true,
                    sortorder: "desc",
                    caption: "List Product Details",
                    scrollOffset: 0
                });
        });

    </script>
    <title>Index</title>
</head>
<body>

    <div>
        <div>
            <div>
                <table id="tblJQGrid">
                </table>

                <br />
                <table id="list">
                </table>
            </div>
            <br />
        </div>
    </div>
</body>
</html>
Posted
Updated 20-Jan-16 22:43pm
v2

1 solution

HTML
<link href="../../Scripts/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/JQGrid/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/JQGrid/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="../../Scripts/JQGrid/grid.locale-en.js" type="text/javascript"></script>

Tbese paths correct?

To test, you can use CDN - jqgrid - cdnjs.com - The free and open source CDN for web related libraries to speed up your website![^].
 
Share this answer
 
Comments
Abhijit Parab 21-Jan-16 6:03am    
yes. paths are correct.

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