【问题标题】:`jqgrid` is not a function error when working in mvc4 cshtml page but working fine in aspx page`jqgrid` 在 mvc4 cshtml 页面中工作时不是函数错误,但在 aspx 页面中工作正常
【发布时间】:2013-05-08 09:38:23
【问题描述】:

当我在 aspx 页面中尝试相同的代码时,我正在尝试将 json 格式数据绑定到 jqgrid,它没有抛出任何错误,但在 cshtml 页面中,它抛出 jqgrid 不是函数的错误。我无法看到设计网格的。我的代码是这样的

<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" });

});

【问题讨论】:

  • 我替换了脚本文件夹,之后它的工作 f9
  • 你是不是已经把jqgrid的依赖放到了aspx页面了?

标签: jquery asp.net asp.net-mvc-3 c#-4.0


【解决方案1】:

类似错误

jqgrid 不是函数

您没有在页面上添加 jqgrid.js 或 jQGrid 文件,

检查页面的“来源”,包括 cshtml 和 aspx 页面

并检查浏览器是否真的添加了 jQgrid。

【讨论】:

  • 有人不懂问答哈哈。。他用“我替换了脚本文件夹之后它的工作f9”是什么意思?????? jqgrid 没有完美地添加.. 大声笑反对选民...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-28
  • 1970-01-01
相关资源
最近更新 更多