【发布时间】:2014-04-24 14:57:43
【问题描述】:
我有两个按钮:
<center>
<p><button id="newuserbutton" >Create New User</button>
<p><button id="edituserbutton" >Edit User</button>
</center>
点击这些按钮中的任何一个都会使用 jQuery 点击功能在弹出对话框中打开“form1”:
<script type="text/javascript">
// On DOM ready (this is equivalent to your $(document).ready(function () { ...} )
$(function() {
// Initialize modal (only once) on #div1
$('#div1').dialog({
modal: true,
autoOpen: false,
minHeight: 300
});
// Bind click on #newuserbutton button
$('#newuserbutton').click(function() {
$('#div1')
// Set buttons
.dialog("option", "buttons", [
{ text: "Create User", click: function() { $(this).dialog(""); } },
{ text: "Cancel", click: function() { $(this).dialog("close"); } }
])
// Set modal title
.dialog('option', 'title', 'Create new user')
// Set modal min width
.dialog({ minWidth: 550 })
// Open modal
.dialog('open');
});
// Bind click on #edituser button
$('#edituserbutton').click(function () {
$('#div1')
// Set buttons
.dialog("option", "buttons", [
{ text: "Save Changes", click: function() { $(this).dialog(""); } },
{ text: "Delete", click: function() { $(this).dialog("alert"); } },
{ text: "Cancel", click: function() { $(this).dialog("close"); } }
])
// Set modal title
.dialog('option', 'title', 'Edit User')
// Set modal min width
.dialog({ minWidth: 500 })
// Open modal
.dialog('open');
});
})
</script>
我需要在对话框中使用按钮(不超过两个),例如; "Create User"、"Delete" 等来管理我的后台代码点击事件以操作数据库。我该怎么做?谢谢。
【问题讨论】:
-
我不知道它有什么不同的意义,但它是网页而不是表单。
-
您使用的是 asp.net webforms 还是 asp.net mvc?还有框架版本
标签: c# jquery asp.net jquery-ui-dialog