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

how to know if 'Check All ' checkbox is checked

6 Answers 128 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Loyal User
Top achievements
Rank 1
Loyal User asked on 15 May 2014, 02:11 PM
hi,

I have raddropdowntree , it works well ,
it has a checkbox  to check all nodes ,

what i  want is to know if this checkbox is checked or not (if all nodes are checked) from itemCommand event from server side ..

how to achieve that ,

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 16 May 2014, 03:47 AM
Hi,

The RadDropDownTree doesn't have ItemCommand event. Please have a look into the sample code snippet to check all nodes of RadDropDownTree is checked or not in onClick event of a RadButton. Please elaborate your requirement if it doesn't help.

ASPX:
<telerik:RadDropDownTree ID="raddroptreeCheckNodes" runat="server" ButtonSettings-ShowCheckAll="true" CheckBoxes="SingleCheck" DataSourceID="SqlDataSource1" DataFieldID="id" DataFieldParentID="parentid" DataTextField="text">
    <Localization CheckAll="All Items Checked" />
</telerik:RadDropDownTree>
<telerik:RadButton ID="radbtnCheckNodes" runat="server" Text="Get Checked Nodes"
    OnClick="radbtnCheckNodes_Click">
</telerik:RadButton>

C#:
protected void radbtnCheckNodes_Click(object sender, EventArgs e)
{
    int flag = 0;
    foreach (RadTreeNode node in raddroptreeCheckNodes.EmbeddedTree.GetAllNodes())
    {
        if (node.Checked == false)
        {
            flag = 1;
            break;
        }
    }
    if (flag == 0)
    {
        //all nodes are che checkd
        // your code
    }
}

Thanks,
Shinu.
0
HoHo
Top achievements
Rank 1
answered on 22 Jul 2015, 05:38 PM

Hi Shinu,

 I have a question. If I don't have "RadButton" to fire the event, how do I fire the event when I just check "check all"? Since in , there is no event which is named "OnClientCheckAllButtonClicking" such like "OnClientClearButtonClicking"  

0
Aneliya Petkova
Telerik team
answered on 23 Jul 2015, 07:57 AM
Hi HoHo,

You may use one of the server-events of RadDropDownTree control - for example OnEntriesAdded.
If this doesn't work for you, please explain your scenario in more details and provide us with a sample and we we will do our best to help you.

Regards,
Aneliya Petkova
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
HoHo
Top achievements
Rank 1
answered on 23 Jul 2015, 08:28 AM

Hello Aneliya,

Thank you for your reply! 

 My scenario is I have a and a button. The default setting of the button is disabled. Now, I want to let the button is enabled when I click "check all".   

 I do not know which event can be fired when I click  "check all".

0
Aneliya Petkova
Telerik team
answered on 23 Jul 2015, 12:06 PM
Hi HoHo,

In this case, you can use jQuery to add click event on CheckAll element of the RadDropDownTree:
function pageLoad() {
    $telerik.$(".rddtCheckAll").on("click", function (e) {
        debugger;
        //Add your code here
    });
}


Regards,
Aneliya Petkova
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
HoHo
Top achievements
Rank 1
answered on 23 Jul 2015, 05:34 PM

Hi Aneliya, 

 It works well! Thank you for your help! 

Tags
DropDownTree
Asked by
Loyal User
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
HoHo
Top achievements
Rank 1
Aneliya Petkova
Telerik team
Share this question
or