LayoutItem.FieldName Property
Gets or sets the name of the database field assigned to the current layout item.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | A String value that specifies the name of a data field. |
Remarks
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.
- Declare item type in item settings explicitly:
groupSettings.Items.Add(itemSettings => {
itemSettings.FieldName = "Description";
itemSettings.NestedExtensionType = FormLayoutNestedExtensionItemType.TextBox; //required type here
itemSettings.NestedExtensionSettings.Width = Unit.Percentage(100);
});
- Alternatively, use the overloaded Add method that directly accepts a Model property:
groupSettings.Items.Add(m => m.Description, itemSettings =>
{
itemSettings.FieldName = "Description";
itemSettings.NestedExtensionSettings.Width = Unit.Percentage(100);
});