Applying Validation Rules to Local Property Using LightSwitch in Visual Studio 2012

Applying Validation Rules to Local Property using LightSwitch in Visual Studio 2012

In my previous article (http://www.c-sharpcorner.com/UploadFile/18ddf7/creating-a-local-property-in-lightswitch-visual-studio-2012/) I described how to create a Local Property using Light Switch in Visual Studio 2012.

In this article I describe how to apply validations to a Local Property.

Procedure for applying validation rules to a Local Property

Step 1

From the Screen Members List, select the Local Property.

localprop.jpg

Step 2

Open the property window.

propwin0.jpg

Step 3

In the Property window, expand the "Validation" node if it is not already expanded. However we can apply validation rules depending on the type of the Local Property.

propwin1.jpg

Step 4

If the Local Property must have a value then select the "Is Required" check box.

propwin1.jpg

Step 5

In this article I have used a Local Property of Type String. Hence for a string you might set a Maximum Length property. 

propwin2.jpg