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.

Well known Code

In this tutorial we will learn about another very interesting and important section, which is defined in project settings of M# and is applied on elements. The purpose of having this section in project settings is to allow developers to write common and highly reusable code here and then simply reference it in modules and pages.

Important: This section should not be used to write complex code which requires parameters. This section is provided to implement non-parameterized generic code which can be used in multiple scenarios.

In order to add a well-known code please follow the steps below

• Focus inside “Wellkown code blocks” (Highlighted in above screenshot)

• Enter a simple description of the code (This description is shown in the list of available Well-known codes when referencing)

• Write your code in the code editor

• Build the project in M#

Screenshots below demonstrate this process:


The screenshot above shows that we have a JavaScript code, which closes the modal window. Now we can apply this code in button’s custom action (Buttons actions are explained in Button Actions).