aspnet-devexpress-dot-web-dot-gridviewtemplates-9398c6a6.md
Specifies a template to display data rows.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue(null)]
public virtual ITemplate DataRow { get; set; }
<DefaultValue(Nothing)>
Public Overridable Property DataRow As ITemplate
| Type | Default | Description |
|---|---|---|
| ITemplate | null |
An object that implements the ITemplate interface.
|
When you specify the DataRow property, the control creates a template within a container object of the GridViewDataRowTemplateContainer type.
Refer to the Create Templates topic for information on how to create templates for the Grid View control’s elements.
The code sample below uses a data row template to create a custom cell layout within data rows.
Run Demo: ASPxGridView - Data Row Template
<dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="false">
<Templates>
<DataRow>
<div style="padding: 5px">
<table>
<tr>
<td rowspan="4">
<dx:ASPxBinaryImage ID="ASPxBinaryImage1" runat="server"
Value='<%# Eval("Photo") %>' />
</td>
<td>First Name</td>
<td><%# Eval("FirstName") %></td>
<td>Last Name</td>
<td>%# Eval("LastName") %></td>
</tr>
<tr>
<td>Title</td>
<td colspan="3"><%# Eval("Title") %></td>
</tr>
<tr>
<td>Birth Date</td>
<td><%# Eval("BirthDate", "{0:d}") %></td>
<td>Hire Date</td>
<td><%# Eval("HireDate", "{0:d}") %></td>
</tr>
<tr>
<td colspan="4" style="vertical-align: top;">
<dx:ASPxLabel ID="lblNotes" runat="server" Text='<%# Eval("Notes") %>' />
</td>
</tr>
</table>
</div>
</DataRow>
</Templates>
</dx:ASPxGridView>
See Also