aspnet-devexpress-dot-web-dot-layoutitem.md
Gets or sets the name of the database field assigned to the current layout item.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue("")]
public string FieldName { get; set; }
<DefaultValue("")>
Public Property FieldName As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A String value that specifies the name of a data field.
|
Note
For ASP.NET MVC FormLayout.
If an item type (specified using the MVCxFormLayoutItem.NestedExtensionType property) is not set explicitly, the FormLayout creates a default item, applies your settings to it and uses a corresponding model property to determine a required type. Once the type is determined, the default Layout item is removed, and another item or a required type is created. Note that in this scenario, the FormaLayout gets access to the Model only during data binding, at which time your settings have been already applied to the default item. So, they do not apply to the new item again.
To solve this issue, you can do the following.
groupSettings.Items.Add(itemSettings => {
itemSettings.FieldName = "Description";
itemSettings.NestedExtensionType = FormLayoutNestedExtensionItemType.TextBox; //required type here
itemSettings.NestedExtensionSettings.Width = Unit.Percentage(100);
});
groupSettings.Items.Add(m => m.Description, itemSettings =>
{
itemSettings.FieldName = "Description";
itemSettings.NestedExtensionSettings.Width = Unit.Percentage(100);
});
See Also
ASPxFormLayout.FindItemByFieldName
ASPxFormLayout.FindNestedControlByFieldName
LayoutGroupBase.FindItemByFieldName