This is a migrated thread and some comments may be shown as answers.

RadListBox Unselect/Uncheck Selected Items

2 Answers 344 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Tracy
Top achievements
Rank 1
Tracy asked on 13 Oct 2012, 04:16 AM
Hi,

Is there a way to unselect and uncheck items in a listbox client side without looping through every item in the list?  I see that there is a clearSelection option but this does not uncheck any of the items.
I was hoping to loop through the checked items using the get_checkeditems option but I can't figure out how to loop through the get_checkeditems collection and then uncheck them in javascript.

Thank You
Tracy

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Oct 2012, 06:53 AM
Hi Tracy,

Try the following JavaScript to uncheck the checked RadListBoxItems in the clientside.

JS:
<script type="text/javascript">
  function OnClientClick() {
        var listbox = $find("<%= RadListBox1.ClientID%>");
        var j= listbox.get_checkedItems().length;
        for (var i = 0; i < j; i++) {
            listbox.get_checkedItems()[0].uncheck();
        }
    }
</script>

Hope this helps.

Regards,
Princy.
0
Tracy
Top achievements
Rank 1
answered on 15 Oct 2012, 01:36 PM
Thank you.
That worked.
Tags
ListBox
Asked by
Tracy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Tracy
Top achievements
Rank 1
Share this question
or