4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 27 Jul 2012, 07:25 AM
Hi Ryan,
Try setting the Localization-CheckAllString property of RadComboBox as follows.
ASPX:
Hope this helps.
Regards,
Princy.
Try setting the Localization-CheckAllString property of RadComboBox as follows.
ASPX:
<
telerik:RadComboBox
ID
=
"combo"
CheckBoxes
=
"true"
Localization-CheckAllString
=
"Select all"
runat
=
"server"
>
</
telerik:RadComboBox
>
Hope this helps.
Regards,
Princy.
0

David
Top achievements
Rank 1
answered on 30 Jul 2012, 01:57 PM
I would like to use the RadComboBox localization.checkAllString to change the text when all items are selected, e.g. with all items NOT selected, the checkAllString is "Check All", but when all items ARE selected, I would like to change the text to "Uncheck All".
I looked at the demo at http://demos.telerik.com/aspnet-ajax/combobox/examples/programming/clientevents/defaultcs.aspx, but I don't see any client-side event that fires when the 'check all' checkbox is clicked, and I don't see any properties that will tell me if all items are checked.
Is there a way to dynamically change the "check all" text to "uncheck all" when all items are checked?
Thanks
I looked at the demo at http://demos.telerik.com/aspnet-ajax/combobox/examples/programming/clientevents/defaultcs.aspx, but I don't see any client-side event that fires when the 'check all' checkbox is clicked, and I don't see any properties that will tell me if all items are checked.
Is there a way to dynamically change the "check all" text to "uncheck all" when all items are checked?
Thanks
0

Princy
Top achievements
Rank 2
answered on 31 Jul 2012, 09:11 AM
Hi David,
When user checks the "Check All" checkbox - all RadComboBox items are marked as checked and there is no specific event for that. As a workaround you can try the following code snippet to change the "check all" text to "uncheck all" when all items are checked and vice versa.
CSS:
ASPX:
JS:
C#:
Hope this helps.
Regards,
Princy.
When user checks the "Check All" checkbox - all RadComboBox items are marked as checked and there is no specific event for that. As a workaround you can try the following code snippet to change the "check all" text to "uncheck all" when all items are checked and vice versa.
CSS:
<style type=
"text/css"
>
.Display
{
display
:
none
;
}
</style>
ASPX:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
CheckBoxes
=
"true"
AutoPostBack
=
"true"
EnableCheckAllItemsCheckBox
=
"true"
OnClientItemChecked
=
"OnClientItemChecked"
>
<
Items
>
.............
</
Items
>
</
telerik:RadComboBox
>
<
asp:HiddenField
ID
=
"hdn"
runat
=
"server"
/>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
OnClick
=
"Button1_Click"
CssClass
=
"Display"
/>
JS:
<script type=
"text/javascript"
>
function
pageLoad() {
var
combo = $find(
"<%= RadComboBox1.ClientID %>"
);
var
checkall = $telerik.$(
'.rcbCheckAllItemsCheckBox'
);
var
hdn = document.getElementById(
"hdn"
);
checkall.change(
function
() {
var
isChecked = checkall.attr(
'checked'
) ?
true
:
false
;
if
(isChecked ==
true
) {
hdn.value =
"1"
;
}
else
{
hdn.value =
"0"
;
}
var
btn = document.getElementById(
"Button1"
);
btn.click();
});
}
function
OnClientItemChecked(sender, args) {
debugger;
var
hdn = document.getElementById(
"hdn"
);
var
checkall = $telerik.$(
'.rcbCheckAllItemsCheckBox'
);
var
isChecked = checkall.attr(
'checked'
) ?
true
:
false
;
if
(isChecked ==
true
) {
hdn.value =
"1"
;
var
btn = document.getElementById(
"Button1"
);
btn.click();
}
else
{
hdn.value =
"0"
;
}
}
</script>
C#:
protected
void
Button1_Click(
object
sender, EventArgs e)
{
if
(hdn.Value ==
"1"
)
{
RadComboBox1.Localization.CheckAllString =
"Uncheck All"
;
}
else
if
(hdn.Value ==
"0"
)
{
RadComboBox1.Localization.CheckAllString =
"check All"
;
}
}
Hope this helps.
Regards,
Princy.
0

Tracy Dryden
Top achievements
Rank 1
answered on 20 Dec 2012, 08:33 PM
The code above does not work if you click on the "Select All" row, only if you click the checkbox itself.
A better way is to add a click event handler to the div containing the select all entry instead:
A better way is to add a click event handler to the div containing the select all entry instead:
var checkalldiv = $telerik.$('div.rcbCheckAllItems');
checkalldiv.click(function() {
...
});