how to know if 'Check All ' checkbox is checked

7 posts, 0 answers
  1. Loyal User
    Loyal User avatar
    37 posts
    Member since:
    Apr 2012

    Posted 15 May 2014 Link to this post

    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 ,
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 May 2014 in reply to Loyal User Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. HoHo
    HoHo avatar
    3 posts
    Member since:
    Jul 2015

    Posted 22 Jul 2015 in reply to Shinu Link to this post

    Hi Shinu,

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

  5. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 23 Jul 2015 Link to this post

    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
  6. HoHo
    HoHo avatar
    3 posts
    Member since:
    Jul 2015

    Posted 23 Jul 2015 in reply to Aneliya Petkova Link to this post

    Hello Aneliya,

    Thank you for your reply! 

     My scenario is I have a raddropdowntree 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".

  7. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 23 Jul 2015 Link to this post

    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
  8. HoHo
    HoHo avatar
    3 posts
    Member since:
    Jul 2015

    Posted 23 Jul 2015 in reply to Aneliya Petkova Link to this post

    Hi Aneliya, 

     It works well! Thank you for your help! 

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017