点击"上传"我尝试打开一个新对话框" delimitedFileDialog"的按钮对话框,因为当我点击"上传" " delimitedFileDialog"对话框自动关闭,所以我想利用close事件打开一个新的,是否可行?我是JQuery的新手,请给我一些提示。当"上传"时,如何打开新对话框?被击中?
<script type="text/javascript">
$(function () {
var uploadDialog, previewDialog;
uploadDialog = $("#delimitedFileDialog").dialog({
autoOpen: false,
appendTo: "form",
height: "auto",
width: "auto",
modal: true,
close: function (event, ui) {
previewDialog = $("#bomListPreviewDialog").dialog({
autoOpen: false,
appendTo: "form",
height: "auto",
width: "auto",
modal: true,
});
previewDialog.dialog("open");
},
});
$("#newDelimited").button().on("click", function () {
uploadDialog.dialog("open");
});
});
</script>
以下是&#34; delimitedFileDialog&#34;的代码。
<div class="dialogueModal" id="delimitedFileDialog" title="New from delimited file">
<asp:FileUpload ID="delimitedFileUpload" runat="server" />
<br /><br />
<div align="center">
<asp:Button ID="uploadBtn" runat="server" Text="Upload" OnClick="btnNewDelimited_Click"/>
</div>
</div>
我在btnNewDelimited_Click方法中设置了断点,该方法可以很好地生成解析数据并将它们绑定到&#34; delimitedPreview&#34; GridView,但此对话框未显示。
<div class="dialogueModal" id="bomListPreviewDialog" title = "BOM Preview">
<asp:GridView ID="delimitedPreview" DataKeyNames="PartNumber" runat="server" AutoGenerateColumns="false">
...Columns DEF...To save space....
</asp:GridView>
任何人都可以帮助我吗?提前谢谢。
答案 0 :(得分:0)
只需移动负责在事件外创建第二个对话框(#bomListPreviewDialog)的代码,在页面加载时创建对话框,然后在第一个对话框的close
事件中打开第二个对话框previewDialog.dialog("open");
http://jsfiddle.net/5v74phd4/1/
JS:
var uploadDialog, previewDialog;
previewDialog = $("#bomListPreviewDialog").dialog({
autoOpen: false,
appendTo: "form",
height: "auto",
width: "auto",
modal: true
});
uploadDialog = $("#delimitedFileDialog").dialog({
autoOpen: false,
appendTo: "body",
height: "auto",
width: "auto",
modal: true,
close: function (event, ui) {
//previewDialog.dialog("open");
}
});
修改强>
http://jsfiddle.net/5v74phd4/3/
$('#uploadBtn').click(function() {
uploadDialog.dialog("open");
});