Back to Devexpress

GridViewTemplates.DataRow Property

aspnet-devexpress-dot-web-dot-gridviewtemplates-9398c6a6.md

latest3.4 KB
Original Source

GridViewTemplates.DataRow Property

Specifies a template to display data rows.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

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

Property Value

TypeDefaultDescription
ITemplatenull

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.

Run Demo: ASPxGridView - Data Row Template

aspx
<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

GridViewTemplates Class

GridViewTemplates Members

DevExpress.Web Namespace