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.

Custom Search Elements

Implementing Custom Filter

You can also implement custom filters for any search element, using the custom filter attribute of the related element e.g. we can implement custom filter on “Email” as shown below

Note: Both the above shown filter attributes cannot be used together as the later replaces the former.

Add Filter Code

This attribute is used to overwrite the default filter applied by M#. In the screenshots below we have overwritten the default filter “Email.Contains” with “Email.Equals”

Add Custom Filter

On applying this attribute, M# removes the filter from the AddSearchFilters() methods and generates the code inside GetBaseDataSource(), where you can access the result object holding all the records. You apply the filter directly in the result list object and do not use AddFilter() methods.

Custom Search Fields

M# lets you implements custom search fields as well and encourages using them only when the search filter cannot be applied using list elements. You chose an ASP.NET control from the list or can apply custom mark-up as shown below

Note: For custom filters elements you cannot use attribute “Add Filter Code” explained above

The screenshot above shows the mandatory attributes required to implement a custom search field. The other important attributes are explained below

Control Type

This attribute lets you choose an ASP.NET control from the list as required e.g. Dropdown list, Textbox, Auto Complete etc. This option replaces the “Control Markup” attribute shown above.

Note: You can also use this attribute on list elements search fields as well

Control ID

This attribute is used in conjunction with “Control type” to specify the “ID” of the chosen ASP.NET control.