Version

Column Templates

WebHierarchicalDataGrid™ has four types of templates for its columns: header, footer, item, and alternating item templates. As the name implies, these templates take the place of the header, footer, and individual items of a column.

Custom Columns

WebHierarchicalDataGrid™ provides the ability to create custom columns using column templates. You can embed any control within the template creating a unique look-and-feel for your column along with custom functionality.

Column Templates

You can provide a cell, alternate cell, header, and footer template for a column. Setting a specific template for a column means the template will render in place of the element. For example, specifying an item template for a column will create a template for every cell in that column.

You can also specify an item template without making the entire column a template column. Each cell in a column has a Template and a TemplateId property. You can set either one of these properties to define a template for an individual cell.

Referencing a Control within a Template

You can access a control within an item template by accessing that item and calling its FindControl method.

As for the Header and Footer templates, you can use the TemplateContainer property off of each object to get reference to the template. Use the FindControl method to find the control.

Template Editing

Templates for a column are just HTML within the column. You need to make the column read-only to prevent editing of the HTML. Doing this allows your end-users to edit using any editors in the template but prevent them from editing the actual markup of the template.

Data Binding

Using a column template means you will not get any data binding between an editor control in the template and the data from a field in WebHierarchicalDataGrid; you must specify the column that an editor needs to bind to in order to display data from that column in the editor control.