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.


Navigation acts as the backbone in any website and without effective navigation users cannot access pages. In this tutorial we will discus a very important button action called "Navigate". We will learn two types of navigation using internal pages and using URLs. We will also see the attributes associated with the navigate action to further customisation

M# encourages using the module button and implementing the "Navigate" action for all navigation purposes. You can use the Navigate action to perform internal or external redirection and can customise it further with additional associated attributes e.g opening page in a different browser or popup. M# also facilities development by providing flexible QuerySting options, as you can specify JavaScript, C# statements, or plain text in QueryString. Further to this, M# also suggests required querystring key on the target page.

Page Navigation

M# makes it very easy to redirect users to internal pages of a website. When you add a navigation action inside a button, selecting the "Page" attribute, M# displays a list of all the internal pages, which can be filtered by writing the name of the key of the page.

It not only helps in reducing the time to write the redirection code but also eradicates the broken URL problem by updating the redirect URL when you change the name or hierarchy of the target page.

The screenshot below shows a list button using a navigate action, redirecting to the edit page and suggests that the target page demands "id" of the record in Querystring.

"PageURL" method is implemented in the UserControl class in M#, which is inherited by every module in M#. This method accepts the "resource key" of the target page in sitemap and returns the relative URL of the page.

URL Navigation

M# also supports dynamic or external navigation and provides "URL" attribute for this purpose. This attribute replaces the above mentioned "Page" attribute. On selecting this attribute you can provide a static or dynamic URL for external or internal URLs.

Important: For Internal pages you must always use the "Page" attribute and should select the appropriate target page. This attribute should only be used when you need to redirect to an external page or using URL Routing / rewriting where you use dynamic page URLs.

The image below shows the "URL" attribute for navigating a static external page. You can use "C#" section to provide dynamic URL.

Customising Navigate Action

The navigate action can be customised further by using associated attributes shown below e.g. running the action on server side, changing the target window etc.

You can also manage exception throwing for any action by using "Warn on Validation Exception" and "Warn on any exception" (The last two attributes in the above highlighted box). Selecting "true" for these attributes will display the exception message in a message box rather than YSOD (yellow screen of death)

The screenshots above show "id" QueryString type as "C#". This can also be changed by selecting a different type and specifying appropriate code.