0

我有一个带有内联编辑的 jqgrid 工作正常,我的要求是我想禁用 studentId 的编辑选项,我为那个 studentId 列声明了可编辑:false,但是当我单击保存按钮时,我得到了错误......参数字典包含用于方法.....的不可为空类型“System.Int32”的参数“StudentId”的空条目

我的jQuery

    <script type="text/javascript">
    $(function () {
        var lastsel;

        jQuery("#list").jqGrid({
            url: '/Home/GetStudents/',
            datatype: 'json',

            mtype: 'POST',
            colNames: ['StudentID', 'FirstName', 'LastName', 'Email', 'Actions', ],

            colModel: [
      { name: 'StudentID', sortable: false, key: true,editable:false },
      { name: 'FirstName', key: true },
      { name: 'LastName', sortable: false, key: true },
      { name: 'Email', width: 200, sortable: false, key: true },
      { name: 'act', index: 'act', width: 75, sortable: false, editable: false}],
            cmTemplate: { align: 'center', editable: true },
            pager: '#pager',
            width: 750,
            rowNum: 15,
            rowList: [5, 10, 20, 50],
            sortname: 'StudentID',
            sortorder: "asc",
            viewrecords: true,
            caption: ' My First JQgrid',
            gridview: true,
            width: 850,



            gridComplete: function () {
                var ids = jQuery("#list").jqGrid('getDataIDs');

                for (var i = 0; i < ids.length; i++) {
                    var cl = ids[i];

                    be = "<input style='height:22px;width:20px;' type='button' value='E' onclick=\"jQuery('#list').editRow('" + cl + "');\"  />";
                    se = "<input style='height:22px;width:20px;' type='button' value='S' onclick=\"jQuery('#list').saveRow('" + cl + "');\"  />";
                    ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick=\"jQuery('#list').restoreRow('" + cl + "');\" />";
                    jQuery("#list").jqGrid('setRowData', ids[i], { act: be + se + ce });
                }
            },
4

1 回答 1

0

目前尚不清楚哪些信息等待您的服务器部分。你可以尝试使用

prmNames: {id: "StudentID"}

它将id当前发送到服务器的参数重命名为StudentID.

于 2012-12-06T07:37:14.987 回答