简体   繁体   中英

`jqgrid` is not a function error when working in mvc4 cshtml page but working fine in aspx page

i am trying to bind json format data to jqgrid when i am trying the same code in aspx page its not throwing any error but in cshtml page page its throwing error that jqgrid is not a function.i cannt able to see the design of grid.My code is like this

<script language="javascript" type="text/javascript">
$(document).ready(function () {
    var gridimgpath = 'themes/basic/images';
    $("#projectList").jqGrid({
        datatype: "json",
        height: 150,
        colNames: ['WorkSpaceName', 'Id'],
        colModel: [
    { name: 'Id', index: 'Id', width: 600 },
    { name: 'WorkSpaceName', index: 'WorkSpaceName', width: 600 },

    ],
        imgpath: gridimgpath,
        multiselect: true,
        ignoreCase: true,
        hidegrid: false,
        caption: "WorkSpace Name",
        pager: '#gridpager',
        rowNum: 10,
        viewrecords: true,
        rowList: [10, 20, 30, 40]
    });
    $.ajax({
        url: 'OauthVerifierNew',
        type: 'GET',
        dataType: "json",
        contentType: 'application/json; charset=utf-8',
        data: {},
        beforeSend: function () {
            alert("hello")
        },
        success: function (response) {
            $("#projectList").setGridParam({ data: response }).trigger("reloadGrid");
        },
        error: function (error) {
            alert(error);


        }
    });
    $("#projectList").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" });

});

error like

jqgrid is not a function

you are not adding jqgrid.js or jQGrid file on you page,

check "source" of your pages, both in cshtml and aspx page

and check on browser too, if jQgrid is really added or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM