volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Display message in Edit mode

How do I display a system message for the user in Edit mode?

I'm looking for a way to show a yellow message box (like the one diplayed for mirrored pages, with css-class EP-systemMessage), but cant find a way to do it. The PageWarning property on EditPanel is protected so I cant use that, and SystemMessageContainer only seems to work for GuiPlugins in Admin mode:

[GuiPlugIn(DisplayName = "Systemmeddelande", Description = "Systemmeddelande", Area = PlugInArea.EditPanel, Url = "~/Plugin/Edit/MySystemMessages.ascx")]
    public partial class MySystemMessages : EPiServer.UserControlBase
    {

        protected void Page_Load(object sender, EventArgs e)
        {

            var editMode = Page as SystemPageBase;

            if (editMode == null)
                return;

            editMode.SystemMessageContainer.Message = "Ett meddelande"; //not working
            

        }
    }

 

Does anyone know how to do this?

#49464
Mar 18, 2011 8:40
Vote:

With some inspirtation from here, you might do something like this:

protected void Page_Load(object sender, EventArgs e)
{
    var editMode = Page as SystemPageBase;
    if (editMode == null)
        return;
    editMode.LoadComplete += new EventHandler(editMode_LoadComplete);
}
protected void editMode_LoadComplete(object sender, EventArgs e)
{
    var editPanel = sender as EditPanel;
    editPanel.Validators.Add(new StaticValidator("Some error message"));
}

protected void Page_Load(object sender, EventArgs e)
{

    var editMode = Page as SystemPageBase;

    if (editMode == null)

        return;

    editMode.LoadComplete += new EventHandler(editMode_LoadComplete);

}

protected void editMode_LoadComplete(object sender, EventArgs e)
{

    var editPanel = sender as EditPanel;

    editPanel.Validators.Add(new StaticValidator("Some error message"));

}

#49472
Mar 18, 2011 10:59

Thanx Jocke! That works - awesome.

My messages are not always a "real" warning, and this solution shows the yellow message box with the warning-icon.

But this is ok for me, and hopefully it helps someone else too.

#49473
Mar 18, 2011 11:23
error This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.