all items to be checked by default

Hi
Is it possible for all items to be checked by default when the page loads?

3 Replies 1 reply marked as answer

AS Aravinthan Seetharaman Syncfusion Team December 31, 2020 06:24 AM UTC

Hi Yeadam, 
  
Thanks for contacting Syncfusion Spport. 
 
We have checked your reported query, and we can achieve your requirement by calling selectAll method with true, from created event handler. 
 
Index.cshtml 
<ejs-listbox id="listbox" dataSource="@ViewBag.data" created="created"> 
    <e-listbox-selectionsettings showCheckbox="true"></e-listbox-selectionsettings> 
</ejs-listbox> 
 
<script> 
    function created() { 
        var listBox = ej.base.getComponent(document.getElementById("listbox"), "listbox"); 
        listBox.selectAll(true); 
    } 
</script> 
 
HomeController.cs 
using Microsoft.AspNetCore.Mvc; 
namespace WebApplication1.Controllers 
{ 
    public class HomeController : Controller 
    { 
        public IActionResult Index() 
        { 
            ViewBag.data = new string[] { "BadmHennessey Venominton", "Bugatti 
              Chiron", "Bugatti Veyron Super Sport", "SSC Ultimate Aero", 
              "Koenigsegg CCR","McLaren F1", "Aston Martin One- 77", "Jaguar XJ220"  
            }; 
            return View(); 
        }   
    } 
} 
 
 
 
Could you please check the above details, and get back to us, if you need assistance on this. 
  
  
Regards, 
Aravinthan S 


Marked as answer

YE yeadam December 31, 2020 09:25 PM UTC

Thank you very much. It worked great


AS Aravinthan Seetharaman Syncfusion Team January 3, 2021 06:02 AM UTC

Hi Yeadam, 
 
Thanks for the update. 
 
We are happy to hear that your issue has been resolved. Please feel free to contact us, if you need any further assistance on this. 
 
Regards, 
Aravinthan S 


Loader.
Up arrow icon