Tab
A newer version of this page is available. Switch to the current version.

LayoutItemBase.Caption Property

Gets or sets the current layout item caption.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue("")]
public virtual string Caption { get; set; }
<DefaultValue("")>
Public Overridable Property Caption As String

Property Value

Type Default Description
String

String.Empty

A String value that specifies the text content of the current layout item's caption.

Remarks

Note that when a single item is embedded directly to the TabbedLayoutGroup its caption is not displayed by default, because it matches the TabbedLayoutGroup caption and it does not make sense to display two identical captions. To display the item caption, wrap the editor item to the LayoutGroup container with the required caption.

WebForms approach:


<dx:TabbedLayoutGroup ClientInstanceName="tabbedGroupPageControl" Width="100%">
    <Items>
        <dx:LayoutGroup Caption="TestGroup">
            <Items>
                ...
            </Items>
        </dx:LayoutGroup>
    </Items>
</dx:TabbedLayoutGroup>

MVC approach:


@Html.DevExpress().FormLayout(set => {
    set.Name = "FormLayout";
    set.Items.AddTabbedGroupItem(groupSettings => {
        groupSettings.Name = "group";
        groupSettings.Items.AddGroupItem(g => {
            g.Caption = "TestGroup";
            g.Items.Add(item => {
                item.NestedExtensionType = FormLayoutNestedExtensionItemType.TextBox;
                item.Name = item.Caption = "Test Description";
                item.SetNestedContent(() => {

                Html.DevExpress().TextBox(tb => {
                    tb.Name = "Test Description";
                    tb.ShowModelErrors = true;
                }).Bind(Model.Description).Render();
            });
        });
    });
});
}).GetHtml();
NOTE

The ASPxFormLayout.EncodeHtml property is not in effect for the Caption property. So the Caption property value is not HTML encoded and is rendered as pure HTML markup.

Refer to the HTML Encoding topic for more information.

See Also