The jQuery dialog cannot close when I call function to do instead of clicking the Cancel button. My page has two buttons which are Save and Cancel button. The Cancel button can close the dialog . Now I would like to close the dialog after saving the data;I don't want to refresh the parent page. I call the function in code behind. The function runs but didn't save the dialog box; it reload the page which opening in dialog . Would someone tell me how to solve it. Thanks in advance.
My script:
$(document).ready(function () {
$('#btnCancel').click(function (e) {
e.preventDefault();
CloseDialog();
});
});
function closeMe() {
e.preventDefault();
CloseDialog();
}
function CloseDialog() {
$('#jquery_box').dialog({
autoOpen: false,
resizable: true,
title: name,
modal: true,
});
$('#jquery_box').dialog('close');
}
There is my cancel button
<input id="btnCancel" type="button" value="Cancel" />
There is my code behind to call the function
Dim cs As ClientScriptManager = Page.ClientScript
cs.RegisterStartupScript(Page.GetType(), "close", "closeMe();", True)