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

EnableCheckAllItemsCheckBox "All" entry doesnt fire OnItemChecked event

17 Answers 427 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 16 Sep 2011, 02:01 PM
After adding the new EnableCheckAllItemsCheckBox, when checking the box the OnItemChecked is not fired. For all othe check boxes in the list it is.

17 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Sep 2011, 06:51 AM

sorry by mistake

0
Kalina
Telerik team
answered on 17 Sep 2011, 10:00 AM
Hello Ken,

Your observation is correct - ItemChecked event fires when one item is checked.

When user checks the "Check All" checkbox - all RadComboBox items are marked as checked and added to control CheckedItems collection.  So the simplest approach that you can use is to add an ordinary ASP.NET Button to fire a postback and get these checked items at server-side.
You can see this approach demonstrated here.

In general the idea to add some kind of "checked" server event to "Check All" checkbox is good, and we will consider it for future releases.

Regards,
Kalina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Phuc
Top achievements
Rank 1
answered on 19 Sep 2011, 05:28 AM
Hello Kalina,

"Check All" checkbox event should be distinguished from event of other items for filtering data in code behind.
For example : In my case, when "All" item is checked, data of another Combobox will be refreshed ... So I cannot apply this Comboboxfor my case now.

Regards,
Phuc
0
Kalina
Telerik team
answered on 21 Sep 2011, 04:42 PM
Hello Phuc,

I suppose that I haven't been precise enough in my previous post.
The ItemChecked event rises when an item checkbox is checked.
Of course when the CheckAll checkbox is checked - a different event will be fired.

All the best,
Kalina
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Phuc
Top achievements
Rank 1
answered on 22 Sep 2011, 07:56 AM
Thanks Kalina,
I'll try it

Regards,
Phuc
0
Stuart Hemming
Top achievements
Rank 2
answered on 14 Feb 2012, 02:36 PM
Is there likely to be any progress on this?

I really don't want to have to use a separate control just to force a postback if the user clicks on the Check All option.

Can anyone think of a workaround?

--
Stuart
0
Stuart Hemming
Top achievements
Rank 2
answered on 14 Feb 2012, 02:46 PM
> Can anyone think of a workaround?
Hmmm, as the client Checked event doesn't fire either, maybe not.

--
Stuart
0
Kalina
Telerik team
answered on 14 Feb 2012, 02:53 PM
Hello Stuart Hemming,

I am afraid that this issue is not addressed yet, but I can provide you a workaround.

Please try attaching a change() event handler at CheckAllItemsCheckbox in this way:
<title></title>
<script type="text/javascript" language="javascript">
function onLoad(sender) {
    $telerik.$('.rcbCheckAllItemsCheckBox').change(function() {       
     __doPostBack();
                      
    });
}
    
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadComboBox ID="RadComboBox1" runat="server"
            AutoPostBack="true" OnItemChecked="RadComboBox1_ItemChecked"
            CheckBoxes="true"  OnClientLoad="onLoad"
            EnableCheckAllItemsCheckBox="true" >
            <Items>
                <telerik:RadComboBoxItem Text="item 1" Value="1" />
                <telerik:RadComboBoxItem Text="item 2" Value="2" />
                <telerik:RadComboBoxItem Text="item 3" Value="3" />
            </Items>
        </telerik:RadComboBox>
        <asp:Label ID="lblPostBack" runat="server"></asp:Label>
    
    </div>
    </form>

protected void Page_Load(object sender, EventArgs e)
{
    lblPostBack.Text = this.RadComboBox1.Text;
}
    
protected void RadComboBox1_ItemChecked(object sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
{
    lblPostBack.Text = this.RadComboBox1.Text;
}


Greetings,
Kalina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Stuart Hemming
Top achievements
Rank 2
answered on 14 Feb 2012, 04:38 PM
Kalina,

Thanks for the input.

Sadly, the workaround is of limited utility if there is more than one combobox on the page.

Now, if it were possible to get hold of the necessary details to allow the call to __doPostBack to be targetted correctly...

--
Stuart
0
Yeroon
Top achievements
Rank 2
answered on 15 Feb 2012, 04:19 PM
Since I also use multiple combo's and need this functionality I resolved it by adding hidden submitbuttons for each combo and let each checkall check trigger the corresponding click event of the button instead of a full __doPostback

This way you know what combo triggered this action.

Any new on this functionality (server and clientside event on CheckAll) being part of the Q1 2012 release?

/Yeroon
0
Kalina
Telerik team
answered on 17 Feb 2012, 02:00 PM
Hello,

Adding server and client-side events to the "CheckAll" section is already a part of our future plans for the CheckBoxes feature. I will update this thread when the improvement is ready.

Meanwhile you can try attaching the change() event hander in this way:
<head runat="server">
<title></title>
    <script type="text/javascript" language="javascript"  >
    function pageLoad()
    {
               
        var combos = Telerik.Web.UI.RadComboBox.ComboBoxes;
 
            if (combos != null)
            {
                for (var i = 0; i < combos.length; i++)
                {
                    var combo = combos[i];                       
                    var element = combo.get_dropDownElement();
                    var checkAll = $telerik.$(element).find(".rcbCheckAllItemsCheckBox");
                       
                    checkAll.change(function() {  
                        alert(combo._uniqueId);
                        __doPostBack();                  
                    });
  
                }
            }
        }
         
</script>
 
</head>
<body>
    <form id="form1" runat="server">
    <div>
          <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
 
         <telerik:RadComboBox ID="RadComboBox1" runat="server"
            CheckBoxes="true" 
            EnableCheckAllItemsCheckBox="true" >
            <Items>
                <telerik:RadComboBoxItem Text="item 1" Value="1" />
                <telerik:RadComboBoxItem Text="item 2" Value="2" />
                <telerik:RadComboBoxItem Text="item 3" Value="3" />
            </Items>
        </telerik:RadComboBox>
 
 
         <telerik:RadComboBox ID="RadComboBox2" runat="server"
 
            CheckBoxes="true"
            EnableCheckAllItemsCheckBox="true" >
            <Items>
                <telerik:RadComboBoxItem Text="item 1" Value="1" />
                <telerik:RadComboBoxItem Text="item 2" Value="2" />
                <telerik:RadComboBoxItem Text="item 3" Value="3" />
            </Items>
        </telerik:RadComboBox>
 
    </div>
    </form>
</body>


All the best,
Kalina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Moon
Top achievements
Rank 2
answered on 30 Apr 2013, 11:55 PM
What's the status of this? It's more than a year later and it's still not allowing a checkall event.
0
Stuart Hemming
Top achievements
Rank 2
answered on 02 May 2013, 08:58 AM
Hi All,

I've added an item to the feedback portal for this as this seems to be the preferred method for recording feature requests and bugs.

Why not go and add a vote for it and see if we can get this missing functionality included in the core product?
0
Milad Doraki
Top achievements
Rank 1
answered on 22 Jul 2013, 06:41 AM

 

Hello,everybody.suggest me is for you :

 

 

 

<telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
<script type="text/javascript">
 
function onLoad(sender, arg) {
 
 $telerik.$($telerik.$(sender.get_dropDownElement()).find(".rcbCheckAllItems")).find(".rcbCheckAllItemsCheckBox").change(function () {
 
    __doPostBack(sender.get_id(),'');
 
 
});
 
}
 
</script>
</telerik:RadCodeBlock>
0
Marcos
Top achievements
Rank 2
answered on 24 Feb 2015, 04:06 PM
Any progress on this... I think it will be a very useful feature for the combo box, since adding an extra click for the users doesn't seem the proper solution.

I'm using the 2015 version the the combo box still behaves the same.
0
Nencho
Telerik team
answered on 27 Feb 2015, 02:19 PM
Hello Marcos,

The proper events for this action are already implemented.You can use OnCheckAllCheck (the server-side event) and the OnClientCheckAllChecked or OnClientCheckAllChecking client-side events.

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Marcos
Top achievements
Rank 2
answered on 13 Apr 2015, 07:14 AM

Thanks!!! it worked perfectly.

 

Tags
ComboBox
Asked by
Ken
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Kalina
Telerik team
Phuc
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Yeroon
Top achievements
Rank 2
Moon
Top achievements
Rank 2
Milad Doraki
Top achievements
Rank 1
Marcos
Top achievements
Rank 2
Nencho
Telerik team
Share this question
or