How to call showDialog from asp.net button click event. My page is a content page with a homepage linked to it.
I tried the following
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
OnClientClick="showDialog('#addPerson');" />
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
OnClientClick="showDialog(#<%=addPerson.ClientID %>);" />
I will also have to call the same function using the gridview template button to change the entry in the dialog box.
<script type="text/javascript">
var dl;
$(document).ready(function () {
$('#addPerson').dialog({
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");
}
});
$('#editPerson').dialog({
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");
}
$("a[id*=ButtonCloseDlg]").click(function (e) {
$("#divDlg").dialog("close");
return false;
});
});
</script>
Tried to call the jquery dialog from the gridview edit control and get the same error. Does the object not support this property or method?
<input type="submit" name="ctl00$ContentPlaceHolder1$GridViewMembers$ctl02$Button1" value="Edit" onclick="showDialog('addPerson');" id="ContentPlaceHolder1_GridViewMembers_Button1_0" />
source
share