Thursday, September 17, 2009

The Silverlight DataForm control

A very impressive demo of the DataForm control, which dynamically generates a data entry form based on a data model. The model can be annotated with metadata tags that control form labels and validation rules. This code would generate a form control for a required numeric value with a specific range (minimum & maximum)

[Display(label="Age:")]
[Required]
[Range(1,115)]
public int age;

The resulting form control would require a numeric value in the form. Its label would be specified by the [Display] tag, and if the user broke the validation rules a validation error message would be displayed automatically.

0 Comments:

Post a Comment

<< Home