in the parameters of the modal dialog you need to pass a link to your callback function as follows:
var opt = SP.UI.$create_DialogOptions(); opt.width = 500; opt.height = 200; opt.url = url; opt.dialogReturnValueCallback = MyDialogClosed; SP.UI.ModalDialog.showModalDialog(opt);
Then in your callback function you can check the status:
function MyDialogClosed(result, value) { if (result == SP.UI.DialogResult.Cancel) {
}
If you need to send material back from your dialogue, you can use this:
function okClicked() { SP.UI.ModalDialog.commonModalDialogClose(1, someobject); }
To do this, you need to connect the function to the OK button in the server-side code, using something like this:
protected override void OnLoad(EventArgs e) { if (Master is DialogMaster) { var dm = Master as DialogMaster; if(dm != null) dm.OkButton.Attributes.Add(@"onclick", @"return okClicked();"); } base.OnLoad(e); }
source share