RadListBox Unselect/Uncheck Selected Items

3 posts, 1 answers
  1. Tracy
    Tracy avatar
    118 posts
    Member since:
    Nov 2010

    Posted 12 Oct 2012 Link to this post

    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. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Oct 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tracy
    Tracy avatar
    118 posts
    Member since:
    Nov 2010

    Posted 15 Oct 2012 Link to this post

    Thank you.
    That worked.
Back to Top