<div class="col-lg-8 control-section sb-property-border dropdown-height">
            Product Category:
            <SfDropDownList TItem="ProductCategory" TValue="string" PopupHeight="230px" Placeholder="Select a Product Category" @bind-Value="@SelectedProductCategoryId" DataSource="@ProductCategoryList">
                <DropDownListEvents TItem="ProductCategory" TValue="string" ValueChange="SelectedProductCategoryOnChange"></DropDownListEvents>
                <DropDownListFieldSettings Text="Name" Value="Id"></DropDownListFieldSettings>
            </SfDropDownList>
          
        </div>
public IEnumerable<CustomersdbShared.Models.ProductCategory> ProductCategoryList { get; set; }

public string SelectedProductCategoryId;

        public void SelectedProductCategoryOnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, ProductCategory> args)
        {
            this.SelectedProductCategoryId = args.ItemData.Id.ToString();
            this.ProductListFiltered = this.ProductList.Where(a => a.ProductTypeId == Convert.ToInt32(this.SelectedProductCategoryId));
        }
Last modified: December 27, 2020

Author

Comments

Write a Reply or Comment