commonModalDialogClose(SP.UI.DialogResult.OK, someValue) 抛出错误 [英] commonModalDialogClose(SP.UI.DialogResult.OK, someValue) throws error
问题描述
在 SharePoint 2010 中,我有一个使用 SP.UI.ModalDialog.showModalDialog
In SharePoint 2010 I have a visual web part that uses SP.UI.ModalDialog.showModalDialog
对话框显示正常,但是当我尝试使用
The dialog shows up fine but when I try to close the dialog using
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, someValue)
我收到一个错误提示
无法获取属性OK"的值:对象为空或未定义
Unable to get value of the property 'OK': object is null or undefined
推荐答案
一个快速/hacky 的解决方法是使用 1,它代表SP.UI.DialogResult.OK
A quick/hacky workaround would be to use 1 which stands for SP.UI.DialogResult.OK
谢谢,我能够使用数字而不是 SP.UI.DialogResult.OK 让它工作.
Thanks, I was able to get this to work using numbers instead of SP.UI.DialogResult.OK.
例如...
SP.UI.ModalDialog.commonModalDialogClose(0,'Canceled the dialog.');
就像使用 SP.UI.DialogResult.cancel
SP.UI.ModalDialog.commonModalDialogClose(0,'Canceled the dialog.');
is like using SP.UI.DialogResult.cancel
SP.UI.ModalDialog.commonModalDialogClose(1,'Yay Success!');
就像使用 SP.UI.DialogResult.OK
SP.UI.ModalDialog.commonModalDialogClose(1,'Yay Success!');
is like using SP.UI.DialogResult.OK
SP.UI.ModalDialog.commonModalDialogClose(-1,'Uh oh... Error');
就像使用 SP.UI.DialogResult.invalid
SP.UI.ModalDialog.commonModalDialogClose(-1,'Uh oh... Error');
is like using SP.UI.DialogResult.invalid
这篇关于commonModalDialogClose(SP.UI.DialogResult.OK, someValue) 抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!