commonModalDialogClose(SP.UI.DialogResult.OK, someValue) 抛出错误 [英] commonModalDialogClose(SP.UI.DialogResult.OK, someValue) throws error

查看:36
本文介绍了commonModalDialogClose(SP.UI.DialogResult.OK, someValue) 抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆