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

Fire a JavaScript when Check All is cliked

4 Answers 112 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 03 Aug 2012, 08:00 PM
Hi,

How can I fire a Javascript when Check All is cliked. Both OnClientItemChecked and OnClientItemChecking dont work when I click Check All checkbox in my dropdown.

Thanks,
RJ

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Aug 2012, 06:11 AM
Hi,

Try the following javascript to raise event on clicking Check All checkbox.
JS:
function onLoad(sender) {
$telerik.$('.rcbCheckAllItemsCheckBox').change(function () {
         if (sender.get_text() == "All items checked") {
             alert(sender.get_text() + " some custom action here");
         }
     });
 }

Thanks,
Shinu.
0
RJ
Top achievements
Rank 1
answered on 07 Aug 2012, 11:29 AM
Hi Shinu,
Where should I attach the onLoad? I added OnclientLoad="onLoad" to my Radcombo but it didnt work. Also I'm useing Masterpage on this.
Thanks,
RJ
0
Shinu
Top achievements
Rank 2
answered on 08 Aug 2012, 08:38 AM
Hi RJ,

Unfortunately I couldn't replicate the issue. Here is the code that I tried based on your scenario which works as expected at my end.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server" EnableCheckAllItemsCheckBox="true" CheckBoxes="true" OnClientLoad="onLoad" >
  <Items>
        ............
   </Items>
</telerik:RadComboBox>

Another approach is that you can raise the event as follows.

Javascript:
<script type="text/javascript">
$telerik.$(
'.rcbCheckAllItemsCheckBox').change(function () {
               // Your code
            });
</script>
0
RJ
Top achievements
Rank 1
answered on 08 Aug 2012, 01:22 PM
Hi Shinu,
new code wont work, but when I tried the first code again it worked now. My bad, I have localized AllItemsCheckedString thats why it didnt work the first time... Thank you so much. 
Tags
ComboBox
Asked by
RJ
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
RJ
Top achievements
Rank 1
Share this question
or