Back to Devexpress

ASPxGridView.Templates Property

aspnet-devexpress-dot-web-dot-aspxgridview-2f07f172.md

latest4.1 KB
Original Source

ASPxGridView.Templates Property

Provides access to the templates used to display the ASPxGridView’s elements (cells, rows, etc.).

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public GridViewTemplates Templates { get; }
vb
Public ReadOnly Property Templates As GridViewTemplates

Property Value

TypeDescription
GridViewTemplates

A GridViewTemplates object that contains templates for displaying data cells, rows, etc.

|

Remarks

A template is a set of HTML elements and Web controls that define the layout for a particular element (area) of a control. The ASPxGridView provides multiple templates that can be accessed via the Templates property. You can provide templates used for displaying cells, column headers, data rows, preview sections, etc.

Concept

Templates

Online Demos

Example

This example shows how to use data row templates (GridViewTemplates.DataRow) to create a custom cell layout within data rows.

The image below shows the result:

aspx
<Templates>
             <DataRow>
                 <div style="padding:5px">
                     <table class="templateTable" cellpadding="2" cellspacing="1" >
                         <tr>
                             <td rowspan="4">"/></td>
                             <td class="templateCaption">First Name</td>
                             <td><%# Eval("FirstName") %></td>
                             <td class="templateCaption">Last Name</td>
                             <td><%# Eval("LastName")%></td>

                         </tr>
                         <tr>
                             <td class="templateCaption">Title</td>
                             <td colspan="3"><%# Eval("Title")%></td>
                         </tr>
                         <tr>
                             <td class="templateCaption">Birth Date</td>
                             <td ><%# Eval("BirthDate")%></td>
                             <td class="templateCaption">Hire Date</td>
                             <td><%# Eval("HireDate")%></td>
                         </tr>
                         <tr>
                         <td colspan="4" style="white-space:normal"><%# Eval("Notes") %> </td>
                         </tr>
                     </table>
                 </div>
             </DataRow>
</Templates>

See Also

Grid View

ASPxGridView Class

ASPxGridView Members

DevExpress.Web Namespace