Tab

GridViewTemplates.DataRow Property

Gets or sets a template for displaying data rows.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

[DefaultValue(null)]
public virtual ITemplate DataRow { get; set; }
<DefaultValue(Nothing)>
Public Overridable Property DataRow As ITemplate

Property Value

Type Default Description
ITemplate

null

An object that implements the ITemplate interface.

Remarks

NOTE

Once a template defined via the DataRow property is created within a grid control, it is instantiated within a container object of the GridViewDataRowTemplateContainer type. This container object exposes a set of specific properties to which the template's child controls can be bound.

Examples

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:

exDataRowTemplate

<Templates>
             <DataRow>
                 <div style="padding:5px">
                     <table class="templateTable" cellpadding="2" cellspacing="1" >
                         <tr>
                             <td rowspan="4"><img src="CardView.aspx?Photo=
                             <%# Eval("EmployeeID")%>"/></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