2014年4月14日 星期一

LightSwitch – Custom Code, Visual Studio 2013

 

Custom Code

Custom Code on ApplicationData in Server Side

 

1. Add a new field, Disable in Customers table

2. Choose Write Code to show out event trigger of Customers table

3. Choose Customers_Validate method

image

 

1. We can get original value of a field before user made change, by entity.Details.Properties.fieldName.OriginalValue

2. results.AddEntityError() to add a validation error

image

 

1. Validation Error pop up if Disable is originally equal to True and user want to change the record.

2. It won’t show if user just change Disable from False to True and then save the record.

image

沒有留言:

張貼留言