0
我有一個jquery對話框,其中我加載了兩個partialview,一個簡單的master/detail 當我回到master後保存細節,單擊按鈕不響應。jquery對話框第二次加載mvc partialview
我張貼一些代碼:
MASTER
$('#dialogActivities').dialog({
autoOpen: false,
open: function (event, ui) {
var id = $(this).data('id');
var urlList = '@Url.Action("ActivityList", "Contacts")';
$(this).load(urlList, function()
{
$(".k-grid-ActivityEdit").bind("click", function()
{
var grid = $("#gridYear").data("kendoGrid");
var selectedData = grid.dataItem(grid.select());
if (selectedData)
{
var urlEdit = '@Url.Action("ActivityEdit", "Contacts")';
$('#dialogActivities').dialog().load(urlEdit);
}
});
});
}
});
DETAIL
$(document).on('submit', '#frmActivityEdit', function()
{
$.ajax({
cache: false,
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result)
{
if (result.success)
{
var model = @Html.Raw(Json.Encode(Model));
var urlList = '@Url.Action("ActivityList", "Contacts")';
$('#dialogActivities').dialog().load(urlList);
}
}
});
return false;
});
它的工作!謝謝!你拯救我的一天! – Berry
這很好:)不客氣 –
現在我有另一個問題,第一次我點擊,打電話正確,但第二次,它打電話兩次,第三次,這就像它需要註冊事件...我嘗試與:$(「。k-grid-ActivityDelete」)。unbind('click');但它不起作用 – Berry