We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to clear the row selection in TreeGrid?

Platform: ASP.NET Web Forms |
Control: TreeGrid

In TreeGrid, by using “clearSelection” public method we can unselect all the selected rows or any specific row. To clear the specific row, we need to pass the index value as argument in “clearSelection” method. When we call this method without any argument it clears all the selected rows. The following code snippet explains how to unselect the row dynamically.

 
<body>
    <form id="form1" runat="server">
        <div>
            <ej:TreeGrid runat="server" ID="Container" ChildMapping="Children" AllowSelection="true">
                <SelectionSettings SelectionMode="Row" SelectionType="Multiple" />
            </ej:TreeGrid>
        </div>
        <div style="float: left;padding-right:10px">
            <ej:NumericTextBox ID="numeric" runat="server" Value="" MinValue="0" MaxValue="14" Height="35" Width="100px" DecimalPlaces="0" />
        </div>
        <div>
            <ej:Button Type="Button" CssClass="e-btn" ClientSideOnClick="unSelect" Height="35" runat="server" Text="Clear Selection">
            </ej:Button>
        </div>
    </form>
    <script type="text/javascript">
        function unSelect() {
            var treeObject = $("#Container").data("ejTreeGrid"),
                textBoxObject = $("#numeric").data("ejNumericTextbox");
            if (!ej.isNullOrUndefined(textBoxObject.model.value))
                treeObject.clearSelection(textBoxObject.model.value);
            else
                treeObject.clearSelection();
        }
    </script>
</body>

 

Sample

Please refer the following link for more information about this Sample

 

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile