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.ItemUpdating Event

Occurs before a layout item(s) is updated.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[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.

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