Skip to main content

MVCxFormLayoutItemCollection<ModelType>.AddGroupItem<ValueType>(Expression<Func<ModelType, ValueType>>, Action<MVCxFormLayoutGroup<ModelType>>) Method

Adds a layout group to the MVCxFormLayoutItemCollection<ModelType> collection and binds this group to the specified Model field.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public MVCxFormLayoutGroup<ModelType> AddGroupItem<ValueType>(
    Expression<Func<ModelType, ValueType>> expression,
    Action<MVCxFormLayoutGroup<ModelType>> method
)

Parameters

Name Type Description
expression Expression<Func<ModelType, ValueType>>

An expression that identifies the object that contains the properties to edit or display.

method Action<MVCxFormLayoutGroup<ModelType>>

A delegate method that accepts MVCxFormLayoutGroup<ModelType> as a parameter.

Type Parameters

Name
ValueType

Returns

Type Description
MVCxFormLayoutGroup<ModelType>

An MVCxFormLayoutGroup<ModelType> object that is the newly added layout group.

Remarks

Use the AddGroupItem<ValueType> method to add a customized layout group bound to the specified Model field.

Refer to the Binding to Data and Item Manipulation topics to learn more.

Example

The code sample below demonstrates how to add a customized layout group with items bound to the specified Model field to the FormLayout extension.

@Html.DevExpress().FormLayout(settings =>
{
    settings.Name = "FormLayout1";

    //Adding a bound to a Model field layout group with layout items
    settings.Items.AddGroupItem(m => m.Contacts, g => 
    {
        //Adding a bound to a Model fields layout items
        g.Items.Add(i => i.Contacts.Phone);
        g.Items.Add(i => i.Contacts.Email);
    });
    ...
}).GetHtml()
See Also