问题描述
我一直在研究在ASP.NET中使用的对话框。这似乎非常不同的,比我已在Windows应用程序中使用的对话框基于Web的应用程序。
I've been researching the use of dialog boxes in ASP.NET. It seems much different for Web-based applications than dialog boxes I have used in Windows applications.
我有自己的提交按钮和code。将ASP.NET表单。在提交按钮的事件处理,它的其他code之间,我想一个模式对话框,要求额外信息的用户,并返回到执行提交按钮的code的其余部分。现在的问题是如何这样做的。
I have an ASP.NET form with its own submit button and code. In that submit button's event handler, among its other code, I would like a modal dialog box to ask the user for additional information and return to executing the rest of the submit button's code. The question is how to about doing that.
jQueryUI的对话框模式窗体是我看过的一个选项。我只是想知道如何对话框消失后继续执行ASP.NET表单的提交按钮code。另外,我有考虑到服务器端/客户端编码之间的区别。
JQueryUI Dialog Modal Form is an option I have looked at. I'm just wondering about how to continue executing the ASP.NET form's submit button code after the dialog box goes away. Also, I have to take into consideration the difference between server-side/client-side coding.
任何意见/建议是大大AP preciated。
Any ideas/suggestions are greatly appreciated.
请注意:我用VS2003和.Net 1.1编码本
Note: I'm coding this with VS2003 and .Net 1.1
推荐答案
请参阅下面链接的问题,我的回答,我用一个隐藏的 ASP:按钮
为回调
:
See my answer on the question linked below, I use a hidden asp:button
for the callback
:
ASP.NET使用jQuery弹出对话框:如何发布回到对话闭幕
标记:
<span onclick='showjQueryUIDialogOkBtnCallback("<%= btnHidden.ClientID%>","<%= yourModalDialog.ClientID%>", "OK", true, 600,600)'>show dialog</span>
<div id="yourModalDialog" runat="server">
your modal dialog div
</div>
<asp:button id="btnHidden" style="display:none" runat="server" onclick="btnHidden_Click"/>
脚本:
function showjQueryUIDialogOkBtnCallback(buttonToClick, dialogSelector, buttonTxt, isModal, width, height)
{
var buttonOpts = {};
buttonOpts[buttonTxt] = function () {
$("#" + buttonToClick).trigger('click');
};
buttonOpts['Cancel'] = function () {
$(this).dialog("close");
$(this).dialog('destroy');
}
$(dialogSelector).dialog({
resizable: false,
height: height,
width: width,
modal: isModal,
open: function (type, data) {
$(this).parent().appendTo("form"); //won't postback unless within the form tag
},
buttons: buttonOpts
});
$(dialogSelector).dialog('open');
}
这篇关于ASP.NET对话框建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!