Skip to main content

CollapsiblePanelSettings.SetContent(Action) Method

Specifies the panel content.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public void SetContent(
    Action contentMethod
)

Parameters

Name Type Description
contentMethod Action

A method to which a template content rendering is delegated.

Remarks

You can define the panel content using the CollapsiblePanelSettings.SetContent (via PanelSettings.SetContent) method.

@Html.DevExpress().Panel(settings =>
{
    settings.Name = "Panel1";

    settings.SetContent(() =>
    {
        // MVC Menu extension as a content
        @Html.DevExpress().Menu(s =>
        {
            s.Name = "Menu";
            s.Items.Add("Item 1");
            s.Items.Add("Item 2");
            s.Items.Add("Item 3");
            s.Items.Add("Item 4");
        }).GetHtml();

        // Custom HTML as a content
        ViewContext.Writer.Write(@"<input id=""myButton"" type=""button"" value=""Button"" />");
    });
}).GetHtml()

The image below illustrates the result. Note that by default, the panel does not produce any visual elements.

MVC_GridView_ImplementationDetails

View Example: Round Panel for ASP.NET MVC - How to define control content

See Also