Select the header checkbox in javascript

3 posts, 0 answers
  1. Su Sundee
    Su Sundee avatar
    3 posts
    Member since:
    Nov 2009

    Posted 23 Apr 2012 Link to this post

    Hello,

    First of all, I'm not good at English. I'm sorry for that.
    I have a TreeList and I used the OnItemSelected and OnItemDeselected client event.
    In this event, how can i know user is selected the header checkbox column or row checkbox column?
    I try the whole day but I still can't find it.
    Anyone, please help me!.

    Thanks & Regards,
    Sundee
  2. Su Sundee
    Su Sundee avatar
    3 posts
    Member since:
    Nov 2009

    Posted 30 Aug 2013 Link to this post

    Hello,

    I have a TreeList and I used the OnItemSelected and OnItemDeselected client event.
    In this event, how can i know user is selected the header checkbox column or row checkbox column?
    I try the whole day but I still can't find it.
    Anyone, please help me!.

    Thanks & Regards,
    Sundee
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Nov 2013 Link to this post

    Hi Su Sundee,

    Please have a look into the sample code I tried to achieve your scenario.

    ASPX:
    <telerik:RadTreeList ID="RadTreeList1" runat="server" DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo"
        AutoGenerateColumns="false" DataSourceID="SqlDataSource1" PageSize="5" ClientDataKeyNames="EmployeeID"
        AllowMultiItemSelection="true">
        <Columns>
            <telerik:TreeListSelectColumn HeaderStyle-Width="38px" UniqueName="EmployeeID">
            </telerik:TreeListSelectColumn>
            <telerik:TreeListBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" HeaderStyle-Width="80px"
                UniqueName="a">
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn DataField="LastName" HeaderText="LastName" UniqueName="b">
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn DataField="ReportsTo" HeaderText="ReportsTo" UniqueName="c">
            </telerik:TreeListBoundColumn>
        </Columns>
        <ClientSettings Selecting-AllowItemSelection="true">
            <ClientEvents OnItemSelected="OnItemSelected"></ClientEvents>
        </ClientSettings>
    </telerik:RadTreeList>

    JavaScript:
    <script type="text/javascript">
        function OnItemSelected(sender, args) {
            var checkbox = $get("RadTreeList1").getElementsByTagName("input")[0];
            if (checkbox.checked == true)
              //header checkbox is selected
            else
                //row checkbox is selected
        }
    </script>

    Thanks,
    Shinu.
Back to Top