Event for Server-Side Select All?

2 posts, 1 answers
  1. John Horton
    John Horton avatar
    1 posts
    Member since:
    Sep 2009

    Posted 01 Apr 2011 Link to this post

    I have a TreeList that allows multiple row selection (server-side) and has a TreeListSelectColumn.  This configuration also creates a checkbox in the header that allows all rows to be selected/deselected.  When an individual row is selected the expected ItemCommand event is triggered on the server-side.  However, when the select-all checkbox in the header is checked and all rows are selected, the subsequent postback does not generate ItemCommand events.  Is there a particular event for this select-all postback? Any recommendations for capturing these selection changes?

    <telerik:RadTreeList ID="OrganizationTreeList"
            There are no organizations to display.
            <telerik:TreeListSelectColumn UniqueName="SelectColumn" HeaderStyle-Width="5%"  />
            <telerik:TreeListBoundColumn DataField="ID" 
                                         ItemStyle-HorizontalAlign="Center" />
            <telerik:TreeListCheckBoxColumn DataField="IsActive"
                                            ItemStyle-HorizontalAlign="Center" />
            <telerik:TreeListBoundColumn DataField="Name"
                                         HeaderStyle-Width="68%" />
        <PagerStyle Mode="NextPrevAndNumeric"  />
  2. Answer
    Marin avatar
    1057 posts

    Posted 07 Apr 2011 Link to this post

    Hello John,

    We confirm that the ItemCommand event does not fire in this case. The issue has been forwarded to our development team for further investigation.
    A temporary workaround would be to attach a client function to the onclick event of the checkbox in the header that fires a command and raises postback on the server. Here is a sample code:

    protected void Page_PreRender(object sender, EventArgs e)
               TreeListItem headerItem = RadTreeList1.GetItems(new TreeListItemType[] { TreeListItemType.HeaderItem })[0];
               (headerItem.Cells[0].Controls[0] as CheckBox).Attributes["onclick"] = "raiseSelect();";

    function raiseSelect()
                    var treelist = $find("<%= RadTreeList1.ClientID %>");
                    //note that this will simulate raising an item command event as if the first data item has been selected

    Feel free to contact us again if you have any other questions.

    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top