DxComboBoxSettings.EmptyDataAreaTemplate Property
Specifies the template used to display custom content in the combo box editor if there are no items to display.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment<ComboBoxEmptyDataAreaTemplateContext> EmptyDataAreaTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<ComboBoxEmptyDataAreaTemplateContext> | The template content. |
Remarks
The combo box editor displays an empty data area if the Data object is empty or the column is bound to an empty object. Define the EmptyDataAreaTemplate
to customize content displayed in the empty data area.
The following code snippet displays a custom text when the Data property of the DxComboBoxSettings
object is empty:
<DxGrid Data="Products"
EditMode="GridEditMode.EditRow"
CustomizeEditModel="Grid_CustomizeEditModel"
EditModelSaving="Grid_EditModelSaving"
ColumnResizeMode="GridColumnResizeMode.NextColumn">
<Columns>
<DxGridCommandColumn DeleteButtonVisible="false" Width="15%" />
<DxGridDataColumn FieldName="ProductName" Width="25%" />
<DxGridDataColumn FieldName="CategoryId" Caption="Category" Width="10%">
<EditSettings>
<DxComboBoxSettings Data="Categories" ValueFieldName="CategoryId" TextFieldName="CategoryName">
<Columns>
<DxListEditorColumn FieldName="CategoryId" Caption="Id" />
<DxListEditorColumn FieldName="CategoryName" Caption="Name" />
</Columns>
<EmptyDataAreaTemplate>
<div>No Data to Display</div>
</EmptyDataAreaTemplate>
</DxComboBoxSettings>
</EditSettings>
</DxGridDataColumn>
<DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="10%">
<EditSettings>
<DxSpinEditSettings MinValue="0M" Mask="n3" />
</EditSettings>
</DxGridDataColumn>
<DxGridDataColumn FieldName="UnitsInStock" />
<DxGridDataColumn FieldName="QuantityPerUnit" Width="15%" />
<DxGridDataColumn FieldName="Discontinued" />
</Columns>
</DxGrid>
@code {
NorthwindContext Northwind { get; set; }
List<Product> Products { get; set; }
List<Category> Categories { get; set; }
protected override async Task OnInitializedAsync() {
Northwind = NorthwindContextFactory.CreateDbContext();
Products = await Northwind.Products.ToListAsync();
// If you comment out the line below, the Categories list is empty
// Categories = await Northwind.Categories.ToListAsync();
}
@* ... *@
}
Implements
See Also