3 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 13 Jan 2014, 07:00 AM
Hi Rahul,
Please try to set the ShowCheckAll property of RadListBox to show a checkbox on clicking on that it will check/uncheck all items in the RadListBox as follows.
ASPX:
Please try the following JavaScript to check/uncheck all items of RadListBox on Button Click.
JavaScript:
Thanks,
Shinu.
Please try to set the ShowCheckAll property of RadListBox to show a checkbox on clicking on that it will check/uncheck all items in the RadListBox as follows.
ASPX:
<
telerik:RadListBox
ID
=
"RadListBox1"
runat
=
"server"
CheckBoxes
=
"true"
ShowCheckAll
=
"true"
>
<
Items
>
<
telerik:RadListBoxItem
Text
=
"Item1"
/>
<
telerik:RadListBoxItem
Text
=
"Item2"
/>
<
telerik:RadListBoxItem
Text
=
"Item3"
/>
<
telerik:RadListBoxItem
Text
=
"Item4"
/>
</
Items
>
</
telerik:RadListBox
>
Please try the following JavaScript to check/uncheck all items of RadListBox on Button Click.
JavaScript:
<script type=
"text/javascript"
>
function
OnClientClicked(sender, args) {
var
listbox = $find(
"<%=RadListBox1.ClientID %>"
);
if
(listbox.get_checkedItems().length == 0) {
for
(
var
i = 0; i < listbox.get_items().get_count(); i++) {
listbox.get_items().getItem(i).check();
}
}
else
{
for
(
var
i = 0; i < listbox.get_items().get_count(); i++) {
listbox.get_items().getItem(i).uncheck();
}
}
}
</script>
Thanks,
Shinu.
0
Rahul
Top achievements
Rank 1
answered on 24 Jan 2014, 09:16 AM
hi shinu,
I wnat to checked/unchecked all checkbox inside the radlistview on button click client side. please provide solution .
my cod is ;
I wnat to checked/unchecked all checkbox inside the radlistview on button click client side. please provide solution .
my cod is ;
<asp:Button ID="btn_select" CssClass="btn btn-sm btn-info" runat="server" Text="Select All Checkbox" UseSubmitBehavior="false"></asp:Button>
<telerik:RadListView ID="RadListView_Permission" runat="server" AllowCustomPaging ="true" AllowPaging="True" onitemdatabound="RadListView_Permission_ItemDataBound" > <ItemTemplate> <div style="border:1px solid gray;"> <table width="100%" > <tr> <td width="5%"></td> <td class="LabelWidth"> <div> <asp:Label ID="Label4" runat="server" Text='<%# (DataBinder.Eval(Container.DataItem, "PermissionItemName")) %>'></asp:Label> </div> </td> <td style="margin:2%; width:70%;"> <span style=" margin:2%;width:50%; text-align:left; "><asp:CheckBoxList RepeatDirection="Horizontal" AutoPostBack="false" CellPadding="5" CellSpacing="7" RepeatLayout="Table" ID="Listbox_Permission" runat="server" DataTextField="PermissionOperationName" DataValueField="PermissionItemOpearationId" CssClass="checkbox-inline checkbox-list" > </asp:CheckBoxList></span> </td> </tr> </table> </div> </ItemTemplate> </telerik:RadListView>
Thanks,
Rahul
0
Hello Rahul,
In order to select all checkbox elements contained in the ListView control you could use the following approach. Attach handler to the Button's OnClientClick event and using jQuery select all checkboxes that have the ListView control as parent. There is a stackoverflow thread discussing similar functionality here.
Give this approach a try and you should get the functionality you are looking for.
Regards,
Viktor Tachev
Telerik
In order to select all checkbox elements contained in the ListView control you could use the following approach. Attach handler to the Button's OnClientClick event and using jQuery select all checkboxes that have the ListView control as parent. There is a stackoverflow thread discussing similar functionality here.
Give this approach a try and you should get the functionality you are looking for.
Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.