Computer Magic Logo

Wednesday, March 16, 2016

Published by Aristotelis Pitaridis

The CMUmbracoToolsRequired attribute works the same way like the RequiredAttribute in ASP.NET MVC. It takes one parameter which is the name of the dictionary which contains the error message that the system will display if the user does not type a value for the specified field.

[CMUmbracoToolsRequired("The Name field is required.")]
public string Name { get; set; }

In order to use the CMUmbracoToolsDisplay attribute we have to define the following using.

using CMUmbracoTools.DataAnnotations;