0
我可以插入新行并对其进行编辑,但我无法删除,因为显然只有在选中该行并处于编辑模式时,值传递给代码隐藏。无法从Kendo网格获取行值,除非它们处于编辑模式
插入/修改/删除类的代码隐藏在C#
这是js代码执行删除操作:
var selectedRow;
// deletes the selected row
function doDelete() {
var grid = $('#Grid').data('tGrid');
if (selectedRow) {
grid.deleteRow($(selectedRow));
}
return false;
}
这是执行编辑代码:
function beginInsert() {
var grid = $('#Grid').data('tGrid');
// enter insert mode
grid.addRow();
// update the selected row
selectedRow = $('#Grid .t-grid-new-row');
// show the 'Insert' and 'Cancel' buttons and hide the 'Delete', 'Create' and 'Edit' buttons
toggleInsertButtons(true);
return false;
}
function endInsert() {
var grid = $('#Grid').data('tGrid');
// perform the insertion - call the _Insert action method
grid.insertRow($(selectedRow));
// hide the 'Insert' and 'Cancel' buttons and show the 'Delete', 'Create' and 'Edit' buttons
toggleInsertButtons(false);
return false;
}
谢谢,这很有帮助。 – zui
@ ui很高兴帮助! – DontVoteMeDown