Telerik has released some sample field template controls for Dynamic Data

One of the very cool extensibility points of Dynamic Data is our field template mechanism. In the existing data controls like GridView and DetailsView when the controls render a column they use some build in classes like BoundField, CheckBoxField, etc to display the column. These are not very extensible and once you decide you want to take over the rendering you need to turn the column into a templated column and manually manage the column yourself. With Dynamic Data what we have done is created a new concept called a Field Template which has a naming convention based on the data type. We provide the source code to these and they live in a directory "DynamicData\FieldTemplates". What this means is if you want to change the way a boolean column is rendered or edited you can go into that directory and modify Boolean.ascx and Boolean_Edit.ascx yourself. Whatever changes you make here will affect the way that booleans are shown and editing across your entire site. You can also add new FieldTemplates with custom names and in that case to make the control use them you can either mark you data model with a UIHint:

[MetadataType(typeof(ProductMetadata))]

public partial Product {

}

 

public class ProductMetadata {

  [UIHint("IntegerSlider")]

  public object UnitsOnOrder { get; set; }

}

 

or do it on page by page basis:

 

<Columns>

<DynamicField DataField="UnitsOnOrder" UIHint="IntegerSlider">

</Columns>

 

This should be really exciting for custom control vendors because they can now create FieldTemplate controls which can be dropped in the directory making our controls automatically use their fancier controls right out of the box. Telerik has released some early samples of some of their controls wrapped in FieldTemplates today which you can look at by jumping to this blog post: https://blogs.telerik.com/AtanasKorchev/Posts/08-04-16/RadControls_and_ASP_NET_Dynamic_Data_-_Part_Deux.aspx?ReturnURL=%2fblogs.aspx. We have other control vendors doing the same thing and I will blog about them when they are released.