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.

Visibility

In this lesson we will learn different options for specifying visibility rules of a module. M# provides visibility control options ranging from standard M# generated rules to query string, roles and user defined rules. M# allows developers to use multiple visibility criteria.

M# implements the visibility criteria in the “OnInit” event of the module also restricting data binding of child controls based on the same criteria.

M# Standard Rules

M# provides some ready made visibility rules based on common and general criteria.

Note: Some of the rules cannot be applied on module e.g. “Else” or “Else if” in above screenshot. These types of rules are applicable on module elements.

False

This rule marks the visibility of a module permanently to false within “Oninit” event of a module as shown below:

Is Insert Mode

This rule decides the visibility base on the “Item (Entity Instance)” property “IsNew” (For more details on “Item” and “Isnew” please reads lesson “Generated Code” in chapter 12 and “The Role of IsNew” in chapter 3 respectively).

Is Local Request

This rule only makes module visible only if the web request is from a local network.

Role Based Visibility

M# allows developers to control the visibility based on the role of the logged in user, as shown below:

The screenshot above decides the visibility of module dependent on if the logged in user has a role “Employee” (For More information on roles please read lesson “Roles” in chapter 13)

QueryString Criteria

M# allows developers to control the visibility based on the “QuerString” key in the URL of the respective page which hosts the module. M# provides three rules for checking a “QueryString” key, as shown in the below screenshot:

Important: Multiple “QueryString” keys must be separated by “|” sign.

Query String Has All

This option can be used to check the existence of single or multiple QueryString keys in the URL in order to decide the visibility of a module. M# applies “&&” operator if multiple keys are specified, as shown below:

Query String Has Any

This option can be used to check the existence of single or multiple QueryString keys in the URL in order to decide the visibility of a module. M# applies “||” operator if multiple keys are specified:

Query String Has None

This option can be used to check the non-existence of all the specified QueryString keys in the URL in order to decide the visibility of a module. M# applies “&&” operator for multiple keys:

Custom Visibility Criteria

M# also gives developers the option to specify custom criteria. This option is used to implement any criteria required by application logic