Northstar Research Partners

Subscribe to this Blog

 

Contact Us!

 
AppTheory wants to talk to you about your business requirements.

Click Contact to fill out an online requirements questionnaire.

Thanks!

 

DotNetNuke Blogs

 

Current Articles | Archives | Search

Add A DotNetNuke Module Message

One of the great things about programming for a framework is that most of the common tasks a web developer would ordinarily be in charge of implementing him/her self have already been taken care of for you. This can save you a tremendous amount of development time, and is always a nice head start. One of these common tasks is alerting users with a message in the UI. DotNetNuke provides methods for displaying messages at both the module and page levels. These methods are located in the DotNetNuke.UI.Skins.Skin namespace. Below is a sample of adding simple warning message for a module that has not yet been configured. You can assume the ModuleHasBeenConfigured() method is a boolean function that performs some checks to see if the module is properly configure.

using DotNetNuke.UI.Skins;
 
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        if (!IsPostBack)
        {
            if (!ModuleHasBeenConfigured())
            {
                Skin.AddModuleMessage(this, Localization.GetString("Warning.Text", this.LocalResourceFile),
                    Localization.GetString("WarningMessage.Text", this.LocalResourceFile),
                    ModuleMessage.ModuleMessageType.YellowWarning);
                return;
            }
        }
    }
    catch (Exception ex)
    {
        Exceptions.ProcessModuleLoadException(this, ex);
    }
}

So the next time your thinking of putting another asp or DNN label on a page to display some message, save yourself some time and use the built in methods of the framework to help you. It will also ensure your module is communicating with your users in a way they are familiar with since the core uses the same methods.


Posted in: DotNetNuke Tips & Tricks on Tuesday, August 12, 2008 11:57 AM by Scott Schecter

COMMENTS

Name (required)

Email (required)

Website

Enter the code shown above:

Privacy Statement | Terms Of Use
Copyright © 2008 AppTheory
Trend Influence TrendCRM AppTheory