Silk skin

TreeList - Custom Editors

Next database reset in 1 hours, 25 minutes, 15 seconds
EmployeeIDLast NameFirst NameTitle of courtesyNotesReportsTo
2FullerAndrewDr.Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.  
  1DavolioNancyMs.Education includes a BA in psychology from Colorado State University in 1970. She also completed "The Art of the Cold Call." Nancy is a member of Toastmasters International.2 
  3LeverlingJanetMs.Janet has a BS degree in chemistry from Boston College (1984). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992.2 
  4PeacockMargaretMrs.Margaret holds a BA in English literature from Concordia College (1958) and an MA from the American Institute of Culinary Arts (1966). She was assigned to the London office temporarily from July through November 1992.2 
 5BuchananStevenMr.Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 1976. Upon joining the company as a sales representative in 1992, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London. He was promoted to sales manager in March 1993. Mr. Buchanan has completed the courses "Successful Telemarketing" and "International Sales Management." He is fluent in French.2 
  8CallahanLauraMs.Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.2 
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadTreeList provides a straightforward way to specify a non-default editor for an editable column. The RadTreeList.CreateColumnEditor event fires whenever a column editor needs to be initialized. The event argument object of type TreeListCreateColumnEditorEventArgs provides the following properties:

  • Column - the TreeListEditableColumn instance for which a column editor will be initialized.
  • DefaultEditor - the default ITreeListColumnEditor instance that the column provides.
  • CustomEditorInitializer - a delegate that does not accept parameters and returns an instance of type ITreeListColumnEditor.

You should provide a delegate function to e.CustomEditorInitializer that instantiates and returns an ITreeListColumnEditor object. A column editor instance usually accepts the target editable column in its constructor.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
<%@ Page Language="VB" Inherits="Telerik.Web.Examples.TreeList.DataEditing.CustomEditors.DefaultVB"CodeFile="DefaultVB.aspx.vb"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="0"></telerik:RadAjaxLoadingPanel>
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="QsfFromDecorator" runat="server" DecorationZoneID="rfd-demo-zone" DecoratedControls="All" EnableRoundedCorners="false" />
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" runat="server">
        <div id="rfd-demo-zone">
            <telerik:RadTreeList RenderMode="Lightweight" runat="server" ID="RadTreeList1" OnCreateColumnEditor="RadTreeList1_CreateColumnEditor" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" DataKeyNames="EmployeeID" AllowMultiItemEdit="true" ParentDataKeyNames="ReportsTo" OnUpdateCommand="RadTreeList1_InsertUpdateCommand" OnInsertCommand="RadTreeList1_InsertUpdateCommand">
                    <telerik:TreeListBoundColumn DataField="EmployeeID" HeaderStyle-Width="60px" HeaderText="EmployeeID" UniqueName="EmployeeID" ReadOnly="true">
                    <telerik:TreeListBoundColumn DataField="LastName" HeaderText="Last Name" HeaderStyle-Width="150px" UniqueName="LastName">
                    <telerik:TreeListBoundColumn DataField="FirstName" HeaderText="First Name" HeaderStyle-Width="150px" UniqueName="FirstName">
                    <telerik:TreeListBoundColumn DataField="TitleOfCourtesy" HeaderText="Title of courtesy" HeaderStyle-Width="100px" UniqueName="Title">
                    <telerik:TreeListBoundColumn DataField="Notes" HeaderText="Notes" UniqueName="Notes">
                    <telerik:TreeListBoundColumn DataField="ReportsTo" HeaderText="ReportsTo" HeaderStyle-Width="90px" UniqueName="ReportsTo" ReadOnly="true" ForceExtractValue="Always">
                    <telerik:TreeListEditCommandColumn UniqueName="EditColumn" HeaderStyle-Width="80px" ButtonType="FontIconButton">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>" DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [TitleOfCourtesy], [Notes], [ReportsTo]) VALUES (@LastName, @FirstName, @TitleOfCourtesy, @Notes, @ReportsTo)" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [TitleOfCourtesy], [Notes], [ReportsTo] FROM [Employees]" UpdateCommand="UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [TitleOfCourtesy] = @TitleOfCourtesy, [Notes] = @Notes, [ReportsTo] = @ReportsTo WHERE [EmployeeID] = @EmployeeID">
            <asp:Parameter Name="original_EmployeeID" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="LastName" Type="String"></asp:Parameter>
            <asp:Parameter Name="FirstName" Type="String"></asp:Parameter>
            <asp:Parameter Name="TitleOfCourtesy" Type="String"></asp:Parameter>
            <asp:Parameter Name="Notes" Type="String"></asp:Parameter>
            <asp:Parameter Name="ReportsTo" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="EmployeeID" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="LastName" Type="String"></asp:Parameter>
            <asp:Parameter Name="FirstName" Type="String"></asp:Parameter>
            <asp:Parameter Name="TitleOfCourtesy" Type="String"></asp:Parameter>
            <asp:Parameter Name="Notes" Type="String"></asp:Parameter>
            <asp:Parameter Name="ReportsTo" Type="String"></asp:Parameter>
    <asp:SqlDataSource runat="server" ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>" SelectCommand="SELECT DISTINCT [TitleOfCourtesy] FROM [Employees]"></asp:SqlDataSource>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?