0

我在一个页面中有两个 jqgrid 但我的问题是当我单击第一个网格的添加按钮时第一行进入编辑模式很好但是当我单击第二个网格编辑模式的添加按钮进入第二个网格的第二行时进入第一行的状态第二网格的任何解决方案提前感谢

 var grid1 = new JQGrid(Name: "ReceiptdetGrid", LoadUrl: "/Receipt/GetGridData",
     Columns: new List<JQGridColumn>() {  
            new JQGridColumn(Name: "Id",ColHeader: "Id", DataType: "string", IsSortable:false, IsFixed:true, IsResize: true,Hidden:true, Width:"0%"),
            new JQGridColumn(Name: "Sno",ColHeader: "SNo.", DataType: "string", IsSortable:false, Width:"10%", IsFixed:true, IsResize: true,Hidden:false),              
            new JQGridColumn(Name: "HeadName",ColHeader: "Head", DataType: "string", IsSortable:true, IsFixed:true, IsResize: true,Width:"45%",IsEditable:true,EditType:"select",Items:(ViewData["headlist"] as List<SelectListItem>),OnChange:"SelectheadChange"),
           new JQGridColumn(Name: "Amount",ColHeader: " Amount", DataType: "string",EditType:"text", Width:"45%", IsSortable:false,OnKeyUp:"CalculateTotalAmmount",IsFixed:true, IsResize: true,Hidden:false,IsEditable:true),
        }, IsPaging: true, PageSize: "8", EditUrl: "/Receipt/KeepGridData", DeleteUrl: "/Receipt/DeleteGridData", IsSortable: true, FooterRow: true, ShowEmptyRows: true, EditType: JQGridEditType.Inline, IsEdit: true, IsDelete: true, IsInsert: true, Width: "900", Height: "200");
            @grid1.GetHtml();                                         
        }

第二个jqgrid

 var grid2 = new JQGrid(Name: "instru", LoadUrl: "/Receipt/GetGridData",
     Columns: new List<JQGridColumn>() {  
            new JQGridColumn(Name: "Id1",ColHeader: "Id1", DataType: "string", IsSortable:false, IsFixed:true, IsResize: true,Hidden:true, Width:"0%"),
            new JQGridColumn(Name: "type",ColHeader: "type", DataType: "string", IsSortable:false, Width:"10%", IsFixed:true, IsResize: true,Hidden:false),              
            new JQGridColumn(Name: "HeadName",ColHeader: "Head", DataType: "string", IsSortable:true, IsFixed:true, IsResize: true,Width:"45%",IsEditable:true,EditType:"select",Items:(ViewData["headlist"] as List<SelectListItem>),OnChange:"SelectheadChange"),
           new JQGridColumn(Name: "Amount",ColHeader: " Amount", DataType: "string",EditType:"text", Width:"45%", IsSortable:false,OnKeyUp:"CalculateTotalAmmount",IsFixed:true, IsResize: true,Hidden:false,IsEditable:true),
        }, IsPaging: true, PageSize: "8", EditUrl: "/Receipt/KeepGridData", DeleteUrl: "/Receipt/DeleteGridData", IsSortable: true, FooterRow: true, ShowEmptyRows: true, EditType: JQGridEditType.Inline, IsEdit: true, IsDelete: true, IsInsert: true, Width: "900", Height: "200");
            @grid2.GetHtml();                                         
        }

当我 ckeck 添加第一个网格的按钮时,它来了但是当我单击第二个网格的添加按钮时,它出现在第二行而不是我的第二个网格的第一行提前谢谢

4

1 回答 1

0

我不确定您如何处理后端的所有内容,但看起来您在两个网格中都访问了相同的 URL:

加载:

LoadUrl: "/Receipt/GetGridData"

编辑:

EditUrl: "/Receipt/KeepGridData"

删除:

DeleteUrl: "/Receipt/DeleteGridData"

因此,除非我弄错了,否则您基本上可能已经制作了两个对其数据使用相同接口的网格。同样,这实际上取决于后端页面如何处理来自这两个网格的加载、编辑和删除请求。

于 2013-06-21T17:37:55.433 回答