M# Tutorials

Learn to build .NET applications with M#. Our step-by-step tutorials will get you up-to-speed rapidly.
If you already know ASP.NET and C#, you can master M# in a week or two.

Show Message

We often need to inform the user about a particular action performed on our webpage e.g. login, submitting a form, requesting a page etc. In this lesson we will learn about displaying information related to an action and will learn the attribute available in M# to customise this notification action.

M# provides a very easy way to display the related information and also allows exiting the execution if necessary. This functionality is provided as a button action “Show Message” which can be used to display validation or custom messages.

After selecting “Show Message” button action, M# adds the notification with default attributes and generates C# code as shown below

“MessageBox” is property implemented by UserControl base class in “M# Framework”, which is inherited by all the modules. This property returns a MessageBoxManager instance, which encapsulates the notification functionality. You can customise the way a message is shown, its contents and execution by using the associated attributes discussed below.

Exit

This attribute is set to “true” by default and is used to break the execution of following button actions. When it is set to true, M# returns the execution right after displaying message.

Text

This attribute is provided to customise the message you want to display. You can use HTML markup, static or dynamic content as required.

Description

This attribute is used to describe the event in a meaningful way.

Gentle Style

This attribute is used to change the message box display layout. This attribute is dependent on “Use message box” attribute, which is explained next.

When selected “true” M# uses “MessageBox.ShowGently()” method to display message contents in a notification bar on the top of the page, as shown in screenshots below:

The screenshot shown above has yellow bar containing the message contents. It fades in, on the top of the page and fades out after clicking the “ok” button. The style of this gentle message bar can be customised using css classes.

When this attribute value is selected as “false”, M# uses “MessageBox.Show()” method to display the message contents in a simple message box as shown below

Use Message Box

This attribute is used to display contents in a gentle top bar or message box when the selected value is “true”. Selecting false value will subdue the “Gentle Style” and displays the contents on the page as text.

Display on Module

This attribute is also used to display contents on the page, when selected value is “True”. M# adds the message contents as child of the module and renders it at the bottom of module after all the contents.


Important: “Use Message Box” and “Display on Module” attribute are mutually exclusive and should be used carefully. Selecting “False” for both attribute will not display the message.

Remove Module Contents

This attribute only works when message contents are displayed on the module as plain text. M# hides all the contents of the module and displayed the message content as plain text.

Is Html

This attribute is used to instruct M# that the message content contains HTML markup.

Criteria

M# provides many attributes to define the visibility criteria of displaying the message. You can define criteria based on roles, custom condition or multiple criteria etc.