使用jQuery模式窗体在ASP.NET [英] Modal form in ASP.NET using jQuery
问题描述
我是比较新的ASP.NET开发,迄今已成功地让事情变得简单,但我现在的要求有点复杂,至今没有得到太多的喜悦。
I'm relatively new to ASP.NET development, have so far managed to keep things simple but I now have a little more complex of a requirement and so far not getting much joy.
基本上我想有一个模式窗体弹出时,按钮被点击添加新的用户,所以我发现的这在jQuery的网站我认为这是诸如此类的事情,我在寻找,但我真的很努力找出适当的方式是把它添加到ASP什么。 NET项目/页。
Essentially I'd like to have a modal form pop up when a button is clicked to add a new user, so I've found this on the jQuery site which I think is the sort of thing I'm looking for but I'm really struggling to figure out what the appropriate way is to add this to an ASP.NET project / page.
任何意见将是非常美联社preciated感谢!
Any advice would be highly appreciated thanks!
推荐答案
您需要包括对的jQuery
引用和 jQuery UI的
。
然后,您需要做的容器的对话,如:
You then need to make a container for your dialog, such as:
<div id="dialog">
<p>
Your content here
</p>
</div>
您接着需要创建对话框,即当 DOM
负载:
You then need to create the dialog, i.e. when the DOM
loads:
$(document).ready(function() {
$("#dialog").dialog({ autoOpen: false, height: 200, width: 200 });
});
然后用一个按钮,打开您的对话框,您可以添加一个简单的 HTML
按钮,并附上通过jQuery。
Then to open your dialog with a button, you can add a simple HTML
button and attach that via jQuery.
<input type="button" ID="btnDialog" value="Click here to open the dialog" />
然后附加到的jQuery
:
$("#btnDialog").click(function() {
$("#dialog").dialog("open");
});
JS小提琴:
http://jsfiddle.net/VtZYD/
确保的jQuery
加载以及 jQuery UI的
这应该被放置在你的&LT; HEAD&GT;
部分:
This should be placed in your <head>
section:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src=http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
您还可以包括 CSS使用
标签:链接
文件
You can also include the CSS
files using a link
tag:
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
这篇关于使用jQuery模式窗体在ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!