MVCxFormLayoutItemCollection<ModelType>.AddGroupItem(Action<MVCxFormLayoutGroup<ModelType>>) Method

Adds a layout group with the specified settings to the MVCxFormLayoutItemCollection<ModelType> collection.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v19.2.dll

Declaration

public MVCxFormLayoutGroup<ModelType> AddGroupItem(
    Action<MVCxFormLayoutGroup<ModelType>> method
)
Public Function AddGroupItem(
    method As Action(Of MVCxFormLayoutGroup(Of ModelType))
) As MVCxFormLayoutGroup(Of ModelType)

Parameters

Name Type Description
method Action<MVCxFormLayoutGroup<ModelType>>

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

Returns

Type Description
MVCxFormLayoutGroup<ModelType>

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

Remarks

The code sample below demonstrates how to add a customized layout group.


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

    //Adding a layout group 
    settings.Items.AddGroupItem(group =>
    {
        //Specifying the caption of the layout group 
        group.Caption = "Personal Info";

        //Specifying the decoration of the layout group 
        group.GroupBoxDecoration = GroupBoxDecoration.HeadingLine;

        //Specifying the number of columns that the layout group spans 
        group.ColSpan = 2;

        //Specifying the number of columns in the layout group
        group.ColCount = 2;

        //Adding layout items onto this group 
        group.Items.Add(i => i.LastName);
        group.Items.Add(i => i.Photo, itemSettings =>
        {
            itemSettings.NestedExtensionType = FormLayoutNestedExtensionItemType.BinaryImage;
            itemSettings.RowSpan = 3;
        });
        group.Items.Add(i => i.FirstName);
        group.Items.Add(i => i.BirthDate);
    });
}).GetHtml()
See Also