我该如何在ASP.NET按钮点击事件中调用showDialog?我的页面是一个与主页面相关联的内容页。
我尝试了以下方法:
尝试从gridview的编辑按钮调用jquery对话框,但出现相同的错误“对象不支持此属性或方法”?
我尝试了以下方法:
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
OnClientClick="showDialog('#addPerson');" />
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
OnClientClick="showDialog(#<%=addPerson.ClientID %>);" />
我还需要从gridview模板按钮调用同样的函数以便在对话框中修改记录。
<script type="text/javascript">
// Used the following example to open the dialog withJquery
var dl;
$(document).ready(function () {
//Adding the event of opening the dialog from the asp.net add button.
//setup edit person dialog
$('#addPerson').dialog({
//Setting up the dialog properties.
show: "blind",
hide: "fold",
resizable: false,
modal: true,
height: 400,
width: 700,
title: "Add New Member",
open: function (type, data) {
$(this).parent().appendTo("form:first");
}
});
//setup edit person dialog
$('#editPerson').dialog({
//Setting up the dialog properties.
show: "blind",
hide: "fold",
resizable: false,
modal: true,
height: 400,
width: 700,
title: "Modify Member",
open: function (type, data) {
$(this).parent().appendTo("form");
}
});
function showDialog(id) {
$('#' + id).dialog("open");
}
// function closeDialog(id) {
// $('#' + id).dialog("close");
// }
//Adding a event handler for the close button that will close the dialog
$("a[id*=ButtonCloseDlg]").click(function (e) {
$("#divDlg").dialog("close");
return false;
});
});
</script>
尝试从gridview的编辑按钮调用jquery对话框,但出现相同的错误“对象不支持此属性或方法”?
<input type="submit" name="ctl00$ContentPlaceHolder1$GridViewMembers$ctl02$Button1" value="Edit" onclick="showDialog('addPerson');" id="ContentPlaceHolder1_GridViewMembers_Button1_0" />
OnClientClick="showDialog('#<%=addPerson.ClientID %>');"
吗? - Bala R