【发布时间】:2012-01-14 08:49:55
【问题描述】:
此代码显示一个带有 html 文本框的 Jquery 对话框,该对话框在用户单击 asp:button btnNewGroup 后显示
<script type="text/javascript" language="javascript">
function pageLoad(sender, args) {
var $dialog = $('<div><fieldset><label for="name">Name</label><input type="text" name="Name" id="name" class="text ui-widget-content ui-corner-all" /></div>')
.dialog({
modal: true,
autoOpen: false,
title: 'Enter New Group Name',
buttons: {
'New': function () {
$(this).dialog('close');
},
Cancel: function () {
$(this).dialog('close');
}
}
});
$("#<%=btnNewGroup.ClientID %>").click(function () {
$dialog.dialog('open');
return true;
});
}
</script>
<asp:Button ID="btnNewGroup" runat="server" Height="26px"
onclick="btnNewGroup_Click" Style="margin-bottom: 0px" Text="New Group"
ClientIDMode="Static" />
protected void btnNewGroup_Click(object sender, EventArgs e)
{
String t = Request.Form["Name"];
}
当用户在对话框中单击新按钮时,我想从文本框中获取名称并在我的代码中使用它作为 asp 新按钮单击事件。
【问题讨论】: