Question

I have a Telerik ListView that contains checkBox items. enter image description here

So, I want in a button to Check all items and in another button to uncheck all the items in this radListView.

How can i do that? Thanks in advance.

Was it helpful?

Solution

Here is the solution... ToggleState.ON to check all and ToggleState.Off to Uncheck all.

for (int item = 0; item < AllowAccess_ListView.Items.Count; item++)
{
     AllowAccess_ListView.Items[item].CheckState = Telerik.WinControls.Enumerations.ToggleState.On;
}

OTHER TIPS

If you add a class to them you can write a simple jQuery/JS for it.

ex: If you add the class "foo" to your items you could use something like this,

Html-

<button id="checkAll">bla</button>
<button id="unCheckAll">bla</button>

-jQuery

Check:

$('#checkAll').click(function () {
  $('.foo').each(function () {
    $(this).prop('checked', true);
  });
});

Uncheck:

$('#unCheckAll').click(function () {
  $('.foo').each(function () {
    $(this).prop('checked', false);
  });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top