How to use the Skin.AddPageMessage () method?

I am developing a DNN module and I want to display an informational message at the top of my ContentPane, but not above the actual module. I found that I DotNetNuke.UI.Skins.Skin.AddPageMessage()should just do something. I am not getting the behavior that I want, but the message simply will not be displayed at all.

There are several overloads of this method, one group accepts an object Page, the other an object Skin.

public static void AddPageMessage(Page page, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType)

public static void AddPageMessage(Skin skin, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType)

I looked at the source of the DNN and found that in the end they actually use the same method private static AddPageMessage(...), which simply searches for the ContentPane inside the provided control and adds a new one ModuleMessageto the collection of controls.

What should I pass as a parameter Pageor Skinto make this correlation work?

Thank...

+5
source share
2 answers

The private AddPageMessage method accepts a rather ambiguous "control" as the first parameter. I believe that this should be the current skin as it uses FindControl for ContentPane.

Doing something like this should give you a link to the current skin:

var skin = Skin.GetSkin((PageBase)this.Page);
Skin.AddPageMessage(skin, "Header", "Message", ModuleMessageType.GreenSuccess);
+4
source

the reason why messages are not displayed is because you turned on "enable partial rendering" in the module management settings.

AJAX ( , true), DNN DNN.

, ( , ) . DNN ajax script , .

* 26.04.2012 10:45:

ScriptManager, , , Page_Load(). NULL, ajax, . bIsAjaxEnabled , .

ScriptManager manager = AJAX.GetScriptManager(Page);
if (manager != null)
{
   bool bIsAjaxEnabled = manager.SupportsPartialRendering;
}
+1

All Articles