This line creates a dialog. By default, the autoOpen
property is true, that's why it's opening the first time.
ph.dialog({
modal: true,
width: 560,
height: 560,
title: "Edit Candidate",
resizable: false
});
The second time it's called, the dialog is already created so it doesn't run again. Instead, create the dialog once and use the open
method to open it...
var ph = $("#DivToAppendPartialView");
ph.dialog({
modal: true,
width: 560,
height: 560,
title: "Edit Candidate",
resizable: false,
autoOpen: false // don't open on creation
});
function EditProduct(cid) {
ph.load("/CandidateDetails/EditCandidateDetails?candidateid=" + cid, function () {
ph.dialog('open');
});
}