我在mvc(table和foreach)中有一个网格。现在每行都有编辑按钮
<button name="button" class="button" id="editCurrentRow" onclick="EditCurrentRow(@item.ID); return false;"> Edit</button>
单击编辑时,将打开对话框以进行编辑。 这是
的脚本function EditCurrentRow(par) {
$("#editResult").dialog('open');
return false;
}
$(document).ready(function (e) {
$('form button').on("click", function (e) {
e.preventDefault;
});
$("#editResult").dialog({
title: 'Edit Admin',
autoOpen: false,
resizable: false,
height: 500,
width: 600,
show: { effect: 'drop', direction: "up" },
modal: true,
draggable: true,
open: function (event, ui) {
$(this).load('@Url.Action("EditAdmin", "AdminSearchResult")', { id: 1 , isEdit : true }); // pass par from function EditCurrentRow(par) in pacle of 1
},
close: function (event, ui) {
$(this).dialog('close');
}
});
});
我的问题是如何将EditCurrentRow(@ item.ID)中的参数传递给
open: function (event, ui) {
$(this).load('@Url.Action("EditAdmin", "AdminSearchResult")', { id: 1 , isEdit : true }); // pass par from function EditCurrentRow(par) in pacle of 1
由于
答案 0 :(得分:2)
function EditCurrentRow(par) {
$("#editResult").dialog({
title: 'Edit Admin',
autoOpen: false,
resizable: false,
height: 500,
width: 600,
show: { effect: 'drop', direction: "up" },
modal: true,
draggable: true,
open: function (event, ui) {
$(this).load('@Url.Action("EditAdmin", "AdminSearchResult")', { id: par, isEdit: true }); // pass par from function EditCurrentRow(par) in pacle of 1
},
close: function (event, ui) {
$(this).dialog('close');
}
});
$("#editResult").dialog('open');
return false;
}