代码之家  ›  专栏  ›  技术社区  ›  Ivan Valadares

如何在Umbraco默认弹出窗口中发送错误消息?

  •  2
  • Ivan Valadares  · 技术社区  · 6 年前

    我将发布事件链接为:

    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
       ContentService.Published += ContentService_Published;
    }
    private void ContentService_Published(global::Umbraco.Core.Publishing.IPublishingStrategy sender, PublishEventArgs<IContent> e)
    {
     // My code , Send Error
    }
    

    当用户“保存并发布”内容时,我想用自定义错误消息显示umbraco默认错误弹出窗口。

    提前谢谢。

    1 回复  |  直到 6 年前
        1
  •  1
  •   wingyip    6 年前

    在你的 ContentService_Published 方法我相信你可以这样做:

    e.Cancel = true;
    e.Messages.Add(new EventMessage("Ouch!", "Better try that again but more gently this time!!!", EventMessageType.Error));