New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Client-side Events

  • Fuller
Event log
  • Demo Configurator

RadDropDownTree  provides a number of client-side events that would allow you to accomplish even the most complicated tasks.

You can attach events to the RadDropDownTree by using either the server-side properties or the client-side API.

  1. Attaching the event handlers
    You can set the property to the name of the function to be called when the event occurs.
    <telerik:RadDropDownTree ID="RadDropDownTree1" runat="server" OnClientDropDownOpening="onClientDropDownOpening" />
                		
  2. Cancelling an event
    The events, whose names end in ing, can be cancelled. You can cancel the event by using the set_cancel method of the event arguments passed to the handler.
    <script type="text/javascript">
    	
        <script type="text/javascript">
    	function onClientDropDownOpening(sender, args)
    	{
    
    		 args.set_cancel(true);
    	}
    </script>
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
<%@ Page AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="DropDownTree.Examples.Programming.ClientSide.DefaultCS"Language="c#"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <script src="scripts.js" type="text/javascript"></script>
    <div class="demo-container size-thin">
        <telerik:RadDropDownTree RenderMode="Lightweight" ID="RadDropDownTree1" runat="server" DefaultMessage="Please select"
            DataFieldID="EmployeeID" DataFieldParentID="ReportsTo" DataTextField="LastName"
            DataSourceID="SqlDataSource1" Width="100%">
            <DropDownSettings Width="200" />
        </telerik:RadDropDownTree>
    </div>
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT * From Employees"></asp:SqlDataSource>
    <qsf:EventLogConsole ID="EventLogConsole1" runat="server" AllowClear="true"/>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadDropDownTree1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadDropDownTree1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ConfigurationPanel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadDropDownTree1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
    </telerik:RadAjaxLoadingPanel>
    <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Demo Configurator">
        <Views>
            <qsf:View Title="Drop down events">
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn1" runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <asp:CheckBox runat="server" ID="DropDownOpening" Text="OnClientDropDownOpening"
                                AutoPostBack="True" Checked="True" />
                        </li>
                        <li>
                            <asp:CheckBox runat="server" ID="DropDownOpened" Text="OnClientDropDownOpened"
                                AutoPostBack="True" Checked="True" />
                        </li>
                        <li>
                            <asp:CheckBox runat="server" ID="DropDownClosing" Text="OnClientDropDownClosing"
                                AutoPostBack="True" Checked="True" />
                        </li>
                        <li>
                            <asp:CheckBox runat="server" ID="DropDownClosed" Text="OnClientDropDownClosed"
                                AutoPostBack="True" Checked="True" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn2" runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <asp:CheckBox runat="server" ID="EntryAdding" Text="OnClientEntryAdding"
                                AutoPostBack="True" Checked="True" />
                        </li>
                        <li>
                            <asp:CheckBox runat="server" ID="EntryAdded" Text="OnClientEntryAdded"
                                AutoPostBack="True" Checked="True" />
                        </li>
                        <li>
                            <asp:CheckBox runat="server" ID="EntryRemoving" Text="OnClientEntryRemoving"
                                AutoPostBack="True" Checked="True" />
                        </li>
                        <li>
                            <asp:CheckBox runat="server" ID="EntryRemoved" Text="OnClientEntryRemoved"
                                AutoPostBack="True" Checked="True" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance