[英]open a jquery dialog on a LinkButton click
I want to open a dialog in an itemtemplate field of a gridview. 我想在gridview的itemtemplate字段中打开一个对话框。
I have a linkbutton on my page and I want to open a jquery dialog when the linkbutton is clicked. 我的页面上有一个linkbutton,当我单击linkbutton时,我想打开一个jquery对话框。
My code is: 我的代码是:
<head>
<script type="text/javascript">
$(document).ready(function(){
$('#LinkButton1').click(function(){
$('#dialog').dialog({modal:true});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
<div id="dialog">
ABid ALi
</div>
</form>
</body>
Why is what I am doing not working? 为什么我不工作?
You can try this. 你可以试试看 This is one of the simple implementation. 这是简单的实现之一。
Javascript Code JavaScript代码
function testFunction(){
alert("test message");
}
Server Side Code 服务器端代码
<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="testFunction();">LinkButton</asp:LinkButton>
I hoe this helps. 我希望这会有所帮助。
add 加
jquery-1.8.2.js and jquery-ui.js files jquery-1.8.2.js和jquery-ui.js文件
in head tag.. 在头标签
using this all jquery code and dialog will be accessible to the browser. 使用此所有jquery代码和对话框,浏览器即可访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.