We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can we make the listbox visible or invisible with one condition?

Thread ID:





146769 Aug 19,2019 09:01 AM UTC Aug 20,2019 11:57 AM UTC Blazor 1
Tags: ListBox
ebi torabi
Asked On August 19, 2019 09:01 AM UTC

How can we make the listbox visible or invisible with one condition?

Sangeetha Priya Murugan [Syncfusion]
Replied On August 20, 2019 11:57 AM UTC

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> 
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 
        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. 
Sangeetha M 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon