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

How to delete the checked items alone from radlistbox

1 Answer 141 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
suresh
Top achievements
Rank 1
suresh asked on 16 Oct 2013, 11:28 AM
I have using radlistbox with checkboxes="true" and  AllowDelete="true" , I am able to checked and unchecked the items. But the default delete option only delete the selected single item. I want to delete checked items only. Is it possible?

Here is the code.
<telerik:RadListBox ID="rlbManaged" EmptyMessage="No objects added" Width="100%"
                AllowDelete="true" Height="120px" 
                CheckBoxes="true" runat="server" SelectionMode="Multiple">
                   <items>
                    <telerik:RadListBoxItem Text="item1" />
                    <telerik:RadListBoxItem Text="item2" />
                    <telerik:RadListBoxItem Text="item3" />
                </items>
    </telerik:RadListBox>
I need to delete the checked items(For example i checked item1 and item3) instead of selected single item. How can i do?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Oct 2013, 12:36 PM
Hi Suresh,

Please have a look into the following code I tried which works fine at my end.

ASPX:
<telerik:RadListBox ID="rlbManaged" EmptyMessage="No objects added" AllowDelete="true"
    OnClientItemChecked="OnClientItemChecked" Height="120px" CheckBoxes="true" runat="server"
    SelectionMode="Multiple">
    <Items>
        <telerik:RadListBoxItem Text="item1" />
        <telerik:RadListBoxItem Text="item2" />
        <telerik:RadListBoxItem Text="item3" />
    </Items>
</telerik:RadListBox>

JavaScript:
<script type="text/javascript">
    function OnClientItemChecked(sender, args) {
        args.get_item().set_selected(true);
    }
</script>

Thanks,
Princy.
Tags
ListBox
Asked by
suresh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or