AgDataGrid in v2010.1 will introduce support for Data Annotations. This is especially useful if you have adopted .NET RIA Services for your data transport.
In the first release the DataGrid will support the following annotation attributes from System.ComponentModel.DataAnnotations
DisplayAttribute
- Order This will tell the grid the position of the field column
- ShortName & Description Will control the column header and tooltip
- AutoGenerateField If this value is set to false the column will not be shown in the grid when auto generates it’s columns from the data source.
EditableAttribute will control whether an end-user can invoke the in-place editor or not.
Example:
public class Customer {
public string FirstName {
get;
set;
}
public string LastName {
get;
set;
}
[Display(ShortName = "Title", Description = "Title of Courtesy")]
public string TitleOfCourtesy {
get;
set;
}
[Display(ShortName="Post", Description="Postal Code (editing is not allowed)"), Editable(false)]
public string PostalCode {
get;
set;
}
[Display(AutoGenerateField = false, Description="Hidden")]
public string Extension {
get;
set;
}
[ReadOnly(true), Display(Order=0, Description="Identifier")]
public int ID {
get;
set;
}
}
Note: we have also added support for the ReadOnlyAttribute
Cheers,
Azret