jQuery UI - 模态
我有以下代码:
<script type="text/javascript">
$(function () {
$('#<%=btn1.ClientID %>').bind('click', function (event) {
$('#modal').dialog({
title: 'title',
modal: true,
buttons: {
'ok': function () {
return true;
},
'cancel': function () {
$(this).dialog('close');
}
}
})
})
})
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="btn1" runat="server" OnClick="btnClick" Text="click me" />
<div id="modal" style="visibility: hidden">
<span>yay!</span>
</div>
</form>
</body>
</html>
我有一个 asp:button,在客户端单击会出现对话框。
正如你所看到的,我有一个 asp:button 处理服务器端的 onclick 事件。然而,onclientclick 事件处理程序也会响应一个事件,该事件会打开一个带有两个按钮的对话框:“确定”和“取消”。但是,对话框消失并且页面从服务器端执行 OnClick 事件。您知道这是为什么以及我如何更改它吗? 我做错了什么?
提前致谢!
I have the following code:
<script type="text/javascript">
$(function () {
$('#<%=btn1.ClientID %>').bind('click', function (event) {
$('#modal').dialog({
title: 'title',
modal: true,
buttons: {
'ok': function () {
return true;
},
'cancel': function () {
$(this).dialog('close');
}
}
})
})
})
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="btn1" runat="server" OnClick="btnClick" Text="click me" />
<div id="modal" style="visibility: hidden">
<span>yay!</span>
</div>
</form>
</body>
</html>
I have an asp:button and on the clientClick the dialog appears.
as you can see I have a asp:button which handles an onclick event on the server-side. However there's also an event that the onclientclick event handler responds to which opens a dialog with two buttons: ok and cancel. However, the dialog disappers and the page executes the OnClick event from the serverside.. Do you have any idea why that is and how I could change that?
What am I doing wrong?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试像这样手动提交表单:
You can try manually submitting the form like this: