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.
Unfortunately, activation email could not send to your email. Please try again.

Check/ Unchek in Listbox

Thread ID:





127606 Nov 28,2016 05:42 AM Nov 29,2016 07:00 AM ASP.NET MVC 1
Tags: ListBox
Asked On November 28, 2016 05:42 AM


how can i check or uncheck a checkbox in a Listbox programmaticly with javascript?
I have a Ajax Post Method. If a user select a Listbox checkbox, it is getting automaticly checked/unchecked. But if there is an Error in the Post-Method i want to undo the check/uncheck.


Selvamani Sankarappan [Syncfusion]
Replied On November 29, 2016 07:00 AM

Hi Arthur,   
Thanks for using Syncfusion products.   
We can check and uncheck the list items of the ListBox component in AJAX success using our existing methods uncheckItemsByIndices and checkItemsByIndices. Please refer to the following code example:   
function click(e) {   
            url: "ListBox/listbox",   
            type: 'POST',   
            dataType: "json",   
            success: function (result) {   
                var obj = $('#listboxsample').data("ejListBox");   
                var checkedindices = obj.model.checkItemsByIndex; //get the checked          items   
                obj.uncheckItemsByIndices(checkedindices); //unchecked items   
               // obj.checkItemsByIndices("2,3"); // check the items   
Refer to the following sample:   
In above sample, we have unchecked the list items that are checked in AJAX success.   
To know more about the list of properties, methods, and events available in ListBox component, please refer to the following link: https://help.syncfusion.com/api/js/ejlistbox#methods:checkitemsbyindices   
Selvamani S.  


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.

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.