Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 当通过ajax加载时,jqGrid是不可编辑的_Jquery_Ajax_Asp.net Mvc_Jqgrid - Fatal编程技术网

Jquery 当通过ajax加载时,jqGrid是不可编辑的

Jquery 当通过ajax加载时,jqGrid是不可编辑的,jquery,ajax,asp.net-mvc,jqgrid,Jquery,Ajax,Asp.net Mvc,Jqgrid,我有一个包含两个单选按钮的页面。在每次单击单选按钮时,我必须在一个div中加载不同的可编辑网格(使用ajax) 当第一次加载页面时,“radio1”将被预先选中,grid1将被加载到container div中。当我单击“radio2”时,它应该将不同的网格加载到相同的container div中 我已经创建了两个单独的局部视图来加载不同的网格,网格设置是在这些局部视图中完成的。在单选单击时,我执行一个ajax调用,将局部视图的结果加载到container div中 当第一次加载页面时,grid

我有一个包含两个单选按钮的页面。在每次单击单选按钮时,我必须在一个div中加载不同的可编辑网格(使用ajax)

当第一次加载页面时,“radio1”将被预先选中,grid1将被加载到container div中。当我单击“radio2”时,它应该将不同的网格加载到相同的container div中

我已经创建了两个单独的局部视图来加载不同的网格,网格设置是在这些局部视图中完成的。在单选单击时,我执行一个ajax调用,将局部视图的结果加载到container div中

当第一次加载页面时,grid1被加载并且是可编辑的,但当我单击任何单选按钮时,它会正确加载网格,但会失去编辑功能(网格变得不可编辑)

我在这方面花了很多时间,但找不到问题所在。请帮忙

谢谢

编辑

这是简化的代码

MVC控制器

public ActionResult Details()
{
    //This returns the main page
     return view();
}

public ActionResult RenderGrid1()
{
    return PartialView();
}

public ActionResult RenderGrid2()
{
    return PartialView();
}
渲染RID1局部视图

渲染RID2局部视图

详细信息视图
加载网格1

加载网格2


@Html.Action(“RenderGrid1”)

两个局部视图的jqGrid配置

    $("#grid").jqGrid({
        caption: "",
        colNames: ['Id', 'Name', 'Code'],
        colModel: [
                { name: 'Id', index: 'Id', hidden: true },
                { name: 'Name', index: 'Name', editable: true, edittype: "text" },
                { name: 'Code', index: 'Code', editable: true, edittype: "text" }
        ],

        other properties....
    });

你能分享你的代码吗?@VimalanJayaGanesh我已经添加了简化的基本代码,谢谢
$(document).ready(function () {
    //JS to initiate jqGrid 2
));
$(document).ready(function () {
    $("#group1").click(function(){
            loadGrid("RenderGrid1");
    });
    $("#group2").click(function(){
            loadGrid("RenderGrid2");
    });

    var laodGrid = function(action){
            $.ajax({
                        type: "POST",
                        url: action,
                        async: false,
                        cache: false,
                        success: function (result) {
                            $("#dvContainer").html(result);
                        }
            });
    }
}
    $("#grid").jqGrid({
        caption: "",
        colNames: ['Id', 'Name', 'Code'],
        colModel: [
                { name: 'Id', index: 'Id', hidden: true },
                { name: 'Name', index: 'Name', editable: true, edittype: "text" },
                { name: 'Code', index: 'Code', editable: true, edittype: "text" }
        ],

        other properties....
    });