【发布时间】:2012-02-18 19:32:34
【问题描述】:
我正在尝试解决包含多个具有服务器端事件的 asp 控件的 jQuery UI 模式对话框的问题。每次单击对话框内的 asp 控件时,模式对话框都会关闭。这些 asp 控件确实具有服务器端逻辑,这些逻辑只是为了与模态交互而执行。
我已经包含了将对话框附加到表单的逻辑(见下文)。 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。谢谢。
-
很抱歉,这里无法为您提供帮助。只是没有足够的工作。当您将 ajax 行为与未经过 ajax 化的服务器控件混合时,总是很难找到这些问题。我不是说不能做,但我尽量避免这种情况。
标签: jquery asp.net jquery-ui dialog modal-dialog