我正在嘗試解決一個包含幾個有服務器端事件的asp控件的jQuery UI模式對話框的問題。每次單擊對話框內的asp控件時,模式對話框都會關閉。這些asp控件確實有服務器端邏輯,只是執行與模態進行交互。當對話框中的asp按鈕被點擊時,如何防止關閉jQuery模式對話框?
我已經包含了將對話框追加到窗體的邏輯(見下文)。 appendTo適用於我的解決方案中具有控件回發的其他對話框。
這種模式的唯一區別是Div包含在用戶控件中。
下面是用來打開對話框腳本:
var $splitdialog;
// render html using web service, then GetSplitViewComplete will open the modal dialog
openDistributedReferenceCodesSplitModalDialog = function (splitdialogDivId, EntityType, EntityId, AllowAdd, AllowAdhoc) {
$splitdialog = $("#" + splitdialogDivId);
$splitdialog.empty();
WebServices.DistributedReferenceCodesService.GetSplitView(EntityType, EntityId, AllowAdd, AllowAdhoc, GetSplitViewComplete);
};
GetSplitViewComplete = function (result) {
// neccessary to support postback for button, dropdowns, etc on modal
$splitdialog.append(result.InnerHtml);
$splitdialog.dialog({ width: 800 }, { height: 'auto' }, { modal: true });
$splitdialog.parent().appendTo($("form:first"));
};
您的建議表示讚賞。
你能提供與該做的工作對話框中的差異更多的細節。正在使用什麼樣的控制? ASP.NET控件,Ajax工具包控件,JQuery UI控件? –
與此對話框的區別在於,用於打開對話框的div位於用戶控件中。用戶控件在列表視圖中重複。我通過將腳本附加到一個按鈕來打開jQuery模式對話框,該按鈕包含要作爲模式打開的div的唯一ID。謝謝。 – ghoh
對不起,不能從這裏幫你。只是沒有足夠的工作。當您將ajax行爲與未被Ajax化的服務器控件混合時,總是很難找到這些問題。我不是說不能做,但我儘量避免這種情況。 –