DevExpress v24.2 Update — Your Feedback Matters
Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.
Take the survey
Not interested
DxDropDownEditSettings.ShowDropDownButton Property
Specifies whether the editor displays the built-in button that invokes a drop-down window.
Namespace : DevExpress.Blazor
Assembly :
DevExpress.Blazor.v24.2.dll
NuGet Package :
DevExpress.Blazor
# Declaration
# Property Value
Type
Default
Description
Boolean
true
true
to display the drop-down button; false
to hide the drop-down button.
Set this property to false
to hide the editor’s drop-down button. The following code snippet hides the drop-down button in a combo box editor:
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
<DxGrid Data ="Products"
EditMode ="GridEditMode.EditRow" >
<Columns >
<DxGridCommandColumn />
<DxGridDataColumn FieldName ="CategoryId" Caption ="Category" >
<EditSettings >
<DxComboBoxSettings Data ="Categories"
ValueFieldName ="CategoryId"
TextFieldName ="CategoryName"
ShowDropDownButton =false >
</DxComboBoxSettings >
</EditSettings >
</DxGridDataColumn >
<DxGridDataColumn FieldName ="ProductName" Width ="25%" />
<DxGridDataColumn FieldName ="UnitPrice" />
<DxGridDataColumn FieldName ="UnitsInStock" />
<DxGridDataColumn FieldName ="QuantityPerUnit" />
</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();
Categories = await Northwind.Categories.ToListAsync();
}
public void Dispose ( ) {
Northwind?.Dispose();
}
}
using Microsoft.EntityFrameworkCore ;
#nullable disable
namespace Grid.Northwind {
public partial class NorthwindContext : DbContext {
public NorthwindContext (DbContextOptions<NorthwindContext> options )
: base (options ) {
}
public virtual DbSet<Category> Categories { get ; set ; }
public virtual DbSet<Product> Products { get ; set ; }
protected override void OnConfiguring (DbContextOptionsBuilder optionsBuilder ) {
if (!optionsBuilder.IsConfigured) {
optionsBuilder.UseSqlServer("Server=.\\sqlexpress;Database=Northwind;Integrated Security=true" );
}
}
protected override void OnModelCreating (ModelBuilder modelBuilder ) {
modelBuilder.HasAnnotation("Relational:Collation" , "SQL_Latin1_General_CP1_CI_AS" );
modelBuilder.Entity<Category>(entity => {
entity.HasIndex(e => e.CategoryName, "CategoryName" );
entity.Property(e => e.CategoryId).HasColumnName("CategoryID" );
entity.Property(e => e.CategoryName)
.IsRequired()
.HasMaxLength(15 );
entity.Property(e => e.Description).HasColumnType("ntext" );
entity.Property(e => e.Picture).HasColumnType("image" );
});
modelBuilder.Entity<Product>(entity => {
entity.HasIndex(e => e.CategoryId, "CategoriesProducts" );
entity.HasIndex(e => e.CategoryId, "CategoryID" );
entity.HasIndex(e => e.ProductName, "ProductName" );
entity.HasIndex(e => e.SupplierId, "SupplierID" );
entity.HasIndex(e => e.SupplierId, "SuppliersProducts" );
entity.Property(e => e.ProductId).HasColumnName("ProductID" );
entity.Property(e => e.CategoryId).HasColumnName("CategoryID" );
entity.Property(e => e.ProductName)
.IsRequired()
.HasMaxLength(40 );
entity.Property(e => e.QuantityPerUnit).HasMaxLength(20 );
entity.Property(e => e.ReorderLevel).HasDefaultValueSql("((0))" );
entity.Property(e => e.SupplierId).HasColumnName("SupplierID" );
entity.Property(e => e.UnitPrice)
.HasColumnType("money" )
.HasDefaultValueSql("((0))" );
entity.Property(e => e.UnitsInStock).HasDefaultValueSql("((0))" );
entity.Property(e => e.UnitsOnOrder).HasDefaultValueSql("((0))" );
entity.HasOne(d => d.Category)
.WithMany(p => p.Products)
.HasForeignKey(d => d.CategoryId)
.HasConstraintName("FK_Products_Categories" );
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial (ModelBuilder modelBuilder ) ;
}
}
public partial class Product {
public Product ( ) {
OrderDetails = new HashSet<OrderDetail>();
}
public int ProductId { get ; set ; }
public string ProductName { get ; set ; }
public int ? SupplierId { get ; set ; }
public int ? CategoryId { get ; set ; }
public string QuantityPerUnit { get ; set ; }
public decimal ? UnitPrice { get ; set ; }
public short ? UnitsInStock { get ; set ; }
public short ? UnitsOnOrder { get ; set ; }
public short ? ReorderLevel { get ; set ; }
public bool Discontinued { get ; set ; }
public virtual Category Category { get ; set ; }
}
public partial class Category {
public Category ( ) {
Products = new HashSet<Product>();
}
public int CategoryId { get ; set ; }
public string CategoryName { get ; set ; }
public string Description { get ; set ; }
public byte [] Picture { get ; set ; }
public virtual ICollection<Product> Products { get ; set ; }
}
To show or hide the editor’s drop-down button at runtime, use the IDropDownEditSettings.ShowDropDownButton property.
See Also