Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxFormLayout.Data Property

Specifies a data item that is bound to the Form Layout items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(null)]
[Parameter]
public object Data { get; set; }

#Property Value

Type Default Description
Object null

A data item.

#Remarks

The Data property specifies a data item from which the Form Layout retrieves its data. Form Layout items must be declared and bound to the data item fields using the Field property. Each item automatically displays a DevExpress data editor suitable for the target data type.

The following example binds the Form Layout to a data item.

Razor
<DxFormLayout Data="@editFormData" >
    <DxFormLayoutItem Field="@nameof(FormDataItem.Name)" ... />
    <DxFormLayoutItem Field="@nameof(FormDataItem.Birthday)" ... />
    <DxFormLayoutItem Field="@nameof(FormDataItem.Worked)" ... />
    <DxFormLayoutItem Field="@nameof(FormDataItem.Position)" ... />
</DxFormLayout>

@code {
    FormDataItem editFormData = new FormDataItem() {
        Name = "Nancy Davolio",
        Birthday = DateTime.Now.AddYears(-30),
        Worked = 3,
        Position = "Sales Representative"
    };
}

You can also bind an item to a complex field (a field that belongs to a data collection’s nested object). To access a complex field, use the following syntax: NestedObject.FieldName.

Run Demo: Form Layout - Bind to Data

See Also