This article explains how to pass an extra parameter to ValueChange event handler of Blazor ComboBox.
In the below code example, additional parameter passed by writing lamda expression for ValueChange event handler and called OnChange method with additional parameter. RAZOR @using Syncfusion.Blazor.DropDowns <SfComboBox ID="ComboBox1" TValue="string" TItem="GameFields" PopupHeight="230px" Placeholder="Select a game" DataSource="@Games"> <ComboBoxEvents TValue="string" TItem="GameFields" ValueChange='((e) => OnChange(e, "ComboBox1"))'/> <ComboBoxFieldSettings Text="Text" Value="ID" /> </SfComboBox> <SfComboBox ID="ComboBox2" TValue="string" TItem="GameFields" PopupHeight="230px" Placeholder="Select a game" DataSource="@Games"> <ComboBoxEvents TValue="string" TItem="GameFields" ValueChange='((e) => OnChange(e, "ComboBox2"))' /> <ComboBoxFieldSettings Text="Text" Value="ID" /> </SfComboBox> @code { public class GameFields { public string ID { get; set; } public string Text { get; set; } } private List<GameFields> Games = new List<GameFields>() { new GameFields(){ ID= "Game1", Text= "American Football" }, new GameFields(){ ID= "Game2", Text= "Badminton" }, new GameFields(){ ID= "Game3", Text= "Basketball" }, new GameFields(){ ID= "Game4", Text= "Cricket" }, new GameFields(){ ID= "Game5", Text= "Football" }, new GameFields(){ ID= "Game6", Text= "Golf" }, new GameFields(){ ID= "Game7", Text= "Hockey" }, new GameFields(){ ID= "Game8", Text= "Rugby"}, new GameFields(){ ID= "Game9", Text= "Snooker" }, new GameFields(){ ID= "Game10", Text= "Tennis"} }; public void OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, GameFields> args, string id) { } }
Refer to our documentation and online samples for more features. If you have any queries, please let us know in the comments below. You can also contact us through our Support forum or Support ticket. We are happy to assist you!
|
This page will automatically be redirected to the sign-in page in 10 seconds.