Hi Ebi,
Thank you for contacting Syncfusion support.
We have checked your reported requirement “To Hide/Show the ListBox component based on condition” and it can be achievable by using CssClass property as like in the below code example.
Code Example:
<EjsListBox Value=@Value DataSource="@Data" TValue="string[]" @ref="CustomListBox"></EjsListBox>
<EjsButton CssClass="e-flat" IsToggle="true" IsPrimary="true" Content="@Content" @ref="ToggleButton" onclick="OnToggleClick"></EjsButton>
<style>
.e-custom-hide{
display:none;
}
</style>
@code{
public string[] Value = new string[] { "Hennessey Venom" };
public List<object> Data = new List<object>
{
new { text = "Hennessey Venom", id = "list-01" },
..//
};
EjsButton ToggleButton;
EjsListBox<string[]> CustomListBox;
public string Content = "Hide";
public void OnToggleClick(UIMouseEventArgs args)
{
if (ToggleButton.Content == "Hide")
{
this.Content = "Show";
CustomListBox.CssClass = "e-custom-hide"; // To hide the ListBox based on the Button text
}
else
{
this.Content = "Hide";
CustomListBox.CssClass = ""; // To show the ListBox based on the Button text
}
}
}
|
For your convenience, we have prepared the sample that hide/show the listbox based on the button text in a click event. Please find the sample link below.
Could you please check the above sample and get back to us with more details, if we have misunderstood your requirement or need further assistance on this.
Regards,
Sangeetha M