如何在 ItemDeleting 事件接收器方法中添加错误消息的链接?
我有一个 SPList 事件接收器方法,例如:
ItemDeleting(ByVal voHttpContex As HttpContext, ByVal voProperties As Microsoft.SharePoint.SPItemEventProperties)
为了阻止不需要的操作,我使用此代码:
voProperties.Cancel = True
voProperties.ErrorMessage="This is my error message."
执行上述代码后,将显示错误页面中的错误消息。
有没有办法在此错误消息中添加指向另一个页面的 html 链接?
我试图使用“a”html 标签,但它明确显示在页面上,并且未被识别为要转换和解析的 Html 代码。 有人知道如何将此链接添加到消息中吗?链接当然应该有一些名称,例如“单击此处”,而不是“http://blablabla.bla”格式。
I have an SPList event receiver method like:
ItemDeleting(ByVal voHttpContex As HttpContext, ByVal voProperties As Microsoft.SharePoint.SPItemEventProperties)
To block unwanted operation i uset this code:
voProperties.Cancel = True
voProperties.ErrorMessage="This is my error message."
After executing above code error message within error page is shown.
Is there a way to add to this error message html link to another page?
I was tying to use "a" html tag but it was displayed explicitly on page and wasn't recognized as a Html code to be transformed and parsed.
Do anybody knows how to add this link to the message? Link should have of course some name like "click here" instead of "http://blablabla.bla" format.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 ErrorMessage 不太可能 - SharePoint 中输出此消息的任何代码都使用 HTMLEncode 而你将无法阻止它。
使用 SP2010 .Cancel 已被折旧,您可以使用 Status = 取消WithRedirectUrl
Unlikely by using ErrorMessage - whatever code in SharePoint is outputing this message is useing HTMLEncode and you're not going to be able to stop that.
With SP2010 .Cancel is depreciated and you could use Status = CancelWithRedirectUrl