AI OnAI Off
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"));
}
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.
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?