Skip to main content

DxFormLayout.ItemUpdating Event

Occurs before a layout item(s) is updated.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<KeyValuePair<string, object>> ItemUpdating { get; set; }

Parameters

Type Description
KeyValuePair<String, Object>

A key/value pairs that specify layout items.

Remarks

Use the ItemUpdating event to handle each item update when the Form Layout is bound to an external data source.

<DxFormLayout Data="@editFormData"
    ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value))">
    <DxFormLayoutItem Field="@nameof(FormDataItem.Name)" .../>
    <DxFormLayoutItem Field="@nameof(FormDataItem.Birthday)" .../>
    <DxFormLayoutItem Field="@nameof(FormDataItem.Worked)" .../>
    <DxFormLayoutItem Field="@nameof(FormDataItem.Position)" .../>
</DxFormLayout>

@code {
    @* ... *@
    void OnItemUpdating(string fieldName, object newValue) {
        if (fieldName == nameof(FormDataItem.Name)) {
            editFormData.Name = newValue.ToString();
        } else if (fieldName == nameof(FormDataItem.Birthday)) {
            editFormData.Birthday = (DateTime)newValue;
        } else if (fieldName == nameof(FormDataItem.Worked)) {
            editFormData.Worked = (int)newValue;
        } else if (fieldName == nameof(FormDataItem.Position)) {
            editFormData.Position = newValue.ToString();
        }
        @* ... *@
    }
}

Run Demo: Form Layout - Bind to Data

See Also