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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Listbox with checkbox select event

Thread ID:





127211 Nov 2,2016 10:02 PM UTC Nov 3,2016 06:49 AM UTC ASP.NET MVC 1
Tags: ListBox
Bernard Jurlina
Asked On November 2, 2016 10:02 PM UTC

I'm trying to exec javascript function on list item checked/unchecked.
I have listbox in my view:

@Html.EJ().ListBox("lstCam").Height("200").Datasource((IEnumerable<CaptureSources>)ViewBag.dsCam).ListBoxFields(df => df.Text("name")).ShowCheckbox(true).ClientSideEvents(e => e.Select("onSelect"))

The function is like this:

<script type="text/javascript">
    function onSelect(args) {
        var target;
        target = $('#lstCam').data("ejListBox");
        var checkedItems = target.getCheckedItems();
        var sel;
        if (checkedItems.length) {
            $(checkedItems).each(function (index, ele) {
                sel += ele.value + ",";

When I run the project, checkboxes in the listbox is looking like filled boxes, instead of checkmarks in empty box. This is something wrong?
And my other problem is when I select one item, the js function is not called.

Maybe a little help?

Prasanth Palani [Syncfusion]
Replied On November 3, 2016 06:49 AM UTC

Hi Bernard,   
Thanks for contacting Syncfusion Support.   
 Query: when I select one item, the JS function is not called.    
If we enable the checkbox, only the checkChange event will be triggered instead of select/change event in the ListBox control. The select and change events are triggered only when the ListBox is rendered without the checkbox.      
Query: When I run the project, checkboxes in the listbox is looking like filled boxes, instead of checkmarks in empty box?      
We were unable to reproduce the above issue. When we ran the project, checkmarks in the checkboxes rendered properly in the ListBox control. Please ensure that you have referred dependent scripts and CSS files in your application. For you reference, we have prepared a simple ListBox MVC application with checkbox enabled. You can get that sample from:   
Sample location: Sample   
If the problem persists still, please modify the provided sample based on your application along with the replication procedure to showcase the issue. Or, you can share the code sample of how you had created the ListBox with checkbox and share the console errors, if any. This would help us to provide an appropriate solution at the earliest. 
Prasanth P 


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

or the page will be automatically redirected to 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