DataBound event is not fired

Hi, I've try to hook the DataBound event to the ListBox and is not fired
<SfListBox TValue="string[]"
           TItem="TestClass"
           DataSource="@Data">
    <ListBoxEvents TValue="string[]"
                   TItem="TestClass"
                   Created="@OnCreate"
                   DataBound="@DataBoundCallback"
                   OnActionComplete="@OnActionCompletedCallback" />
    <ListBoxFieldSettings Text="@nameof(TestClass.Label)" Value="@nameof(TestClass.Id)" />
    <ListBoxSelectionSettings ShowCheckbox />
</SfListBox>

The OnActionComplete and the Create is fired but no the DataBound

1 Reply 1 reply marked as answer

GK Gayathri KarunaiAnandam Syncfusion Team June 4, 2021 02:05 PM UTC

Hi Andy,  

We have checked your reported query. We would like to let you know that we have deprecated the DataBound event in the ListBox component. And we have prepared a sample to get the bounded datasource in Created event using local and remote data. For your reference, please refer below code snippet. 

 
<h4>Remote Data</h4> 
 
@using Syncfusion.Blazor.DropDowns 
@using Syncfusion.Blazor.Data 
 
<SfListBox @ref="Listboxref" TValue="string[]" TItem="OrderDetails" Query="@RemoteDataQuery" > 
<SfDataManager Url="https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders" CrossDomain="true" Adaptor="Syncfusion.Blazor.Adaptors.ODataAdaptor"></SfDataManager> 
<ListBoxFieldSettings Text="CustomerID" Value="CustomerID" /> 
<ListBoxEvents TValue="string[]" Created="create" TItem="OrderDetails" ></ListBoxEvents> 
 
</SfListBox> 
 
@code{ 
    public SfListBox<string[], OrderDetails> Listboxref; 
    public Query RemoteDataQuery = new Query().Select(new List<string>{ "CustomerID" }).Take(6).RequiresCount(); 
    public class OrderDetails 
    { 
    public int? OrderID { get; set; } 
    public string CustomerID { get; set; } 
    public int? EmployeeID { get; set; } 
    public double? Freight { get; set; } 
    public string ShipCity { get; set; } 
    public bool Verified { get; set; } 
    public DateTime? OrderDate { get; set; } 
    public string ShipName { get; set; } 
    public string ShipCountry { get; set; } 
    public DateTime? ShippedDate { get; set; } 
    public string ShipAddress { get; set; } 
    } 
 
    public void create() 
    { 
         var data = Listboxref.GetDataList(); 
    } 
     
} 
 
 
<h4>Local Data</h4> 
 
<SfListBox @ref="ListboxRef" TValue="string[]" DataSource="@Vehicles" TItem="VehicleData"> 
<ListBoxFieldSettings Text="Text" Value="Id" /> 
<ListBoxEvents TValue="string[]" Created="created" TItem="VehicleData"></ListBoxEvents> 
</SfListBox> 
@code { 
     public SfListBox<string[], VehicleData> ListboxRef; 
    public List<VehicleData> Vehicles = new List<VehicleData> { 
    new VehicleData { Text = "Hennessey Venom", Id = "Vehicle-01" }, 
    new VehicleData { Text = "Bugatti Chiron", Id = "Vehicle-02" }, 
    new VehicleData { Text = "Bugatti Veyron Super Sport", Id = "Vehicle-03" }, 
    new VehicleData { Text = "SSC Ultimate Aero", Id = "Vehicle-04" }, 
    new VehicleData { Text = "Koenigsegg CCR", Id = "Vehicle-05" }, 
    new VehicleData { Text = "McLaren F1", Id = "Vehicle-06" }, 
    new VehicleData { Text = "Aston Martin One- 77", Id = "Vehicle-07" }, 
    new VehicleData { Text = "Jaguar XJ220", Id = "Vehicle-08" } 
}; 
 
public class VehicleData { 
  public string Text  { get; set; } 
  public string Id  { get; set; } 
} 
 
public void created() 
    { 
        var Data = ListboxRef.GetDataList(); 
    } 
 
} 


Please check the above sample and provide us with more details if it does not meet your requirement with databound event or could you please share your exact use case scenario. So that we can sort out and provide you the better solution quickly. 
 
Regards, 
Gayathri K 


Marked as answer
Loader.
Up arrow icon