Web 窗体中的 Jquery 对话框
Jquery Dialogbox in webforms
我在Webforms中使用了这个插件。我的表单上有内容占位符,所以我将代码转换为以下内容:
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$('#<%=dialog.ClientID %>').dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
});
$('#<%=opener.ClientID %>').click(function() {
$('#<%=dialog.ClientID %>').dialog("open");
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="dialog" runat="server" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button runat="server" id="opener">Open Dialog</button>
</asp:Content>
但它不起作用。我该如何解决这个问题?
<button>
元素在单击后将页面提交回服务器。这是它在表单(WebForms 页面是表单)中的默认行为,这就是您看不到对话框的原因。
您可以像这样向按钮添加type="button"
:
<button runat="server" type="button" id="opener">Open Dialog</button>
它将阻止按钮将页面发布回服务器,您将能够看到对话框。
相关文章:
- 使用jquery对话框中的箭头键
- 获取打开jquery对话框的button的id
- 我怎么能让jQuery对话框表现得像Javascript警报
- 无法在其他调用上设置jQuery对话框选项
- 如何在jQuery对话框标题栏中添加额外的按钮
- 从jquery对话框恢复原始数据,脚本不起作用
- Jquery对话框('打开')不工作
- 通过Rails中的自定义Jquery对话框处理链接的确认
- 阻止Jquery对话框内容的CSS应用于主窗口
- jquery对话框内容仅针对第一个请求进行对齐
- 在鼠标悬停时保持 JQuery 对话框打开
- 带有 iframe 的 jquery 对话框
- 单击函数生成的 jQuery 对话框中的元素
- 在jquery对话框中加载html页面
- JQuery对话框中的Bootstrap Pills
- JQUERY对话框未捕获错误:初始化之前无法调用对话框上的方法
- Jquery对话框的大小调整只发生在它的第一次's已打开
- 打开对话框后,JQuery对话框的条件调整大小为内容高度
- jquery对话框会记住以前的输入
- Jquery.对话框未从表中的图像输入打开