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.

Column Display Options

In this lesson we will learn about the attributes related to list elements, which are used to customize the display of each column.

Display Expression

This attribute is used to change the display text of the related element. For example, if we want to display list of employees which shows employees details including profile details. Now we don’t want to show the full profile text as it could be very long and just want to show the summarized text. Here we can use the “Display Expression” attribute and can use M# “Summarize” extension method to display shorter text, as shown in the screenshot below

M# uses the specified code to generate ASP.NET mark-up

Display Mode

This is a very useful attribute which makes it easy to display list columns as desired. Using this attribute gives the end user an option to select the required columns to be displayed on the page. You just need to specify the display mode and M# generates the switching functionality.

Always Mode

Selecting this mode sets this column as un-selectable and the user cannot select / un-select this column. The column with this mode is always displayed.

Never Mode

Selecting this mode also sets this column as un-selectable and the user cannot select / un-select this column. The column with this mode is never displayed.

Selectable Mode

The column is set as selectable and is not displayed when the page loads. You have to select this column from the UI button in order to render this column.

After setting modes, if we view the page we will see that only one column is visible and a new link “Select Fields” is added on top of the list, which displays the selectable columns.

M# stores the column preference in cookie which is read during the initialization of the list module and is updated when user changes the preference by selecting different columns.