GridViewTemplates.DataRow Property
Specifies a template to display data rows.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
ITemplate | null | An object that implements the ITemplate interface. |
#Remarks
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.
#Example
The code sample below uses a data row template to create a custom cell layout within data rows.
<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>