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

Manual data editing

Next database reset in 1 hours, 55 minutes, 18 seconds
  IDLast NameFirst NameTitleNotesReportsTo
2FullerxxxxxxxxxtateDr.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. 
 14EverWhat   
 15SmithJim   
 16wxwxwxxwwxwx   
 17zzzorro   
 18emmanueleric   
 20LeguizamoDaniel   
 21taglialatelapino   
 22plutopippo   
 23جباری نیکعلی   

This demo shows how to manually update/insert items to the database. The new values are extracted from the current item using the ExtractValues method.

Note that, when inserting a child item to a parent data item, the foreign key values (the ReportsTo field in our case, specified by the ParentDataKeyNames array in RadTreeList) are extracted into the Hashtable with ExtractValues. We need to check if the foreign key is present in the Hashtable and add it to the insert parameters. When inserting a root item, however, foreign keys are not populated and thus, DbNull should be explicitly added as a foregn key.

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

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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" />
<div class="demo-container no-bg">
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" runat="server">
        <telerik:RadTreeList RenderMode="Lightweight" ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource" OnUpdateCommand="RadTreeList1_UpdateCommand" OnInsertCommand="RadTreeList1_InsertCommand" OnDeleteCommand="RadTreeList1_DeleteCommand" ParentDataKeyNames="ReportsTo" DataKeyNames="EmployeeID" AutoGenerateColumns="false">
            <Columns>
                <telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ButtonType="FontIconButton" ShowEditButton="false" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center"></telerik:TreeListEditCommandColumn>
                <telerik:TreeListButtonColumn CommandName="Edit" Text="Edit" UniqueName="EditCommandColumn" ButtonType="FontIconButton" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center"></telerik:TreeListButtonColumn>
                <telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete" ButtonType="FontIconButton" HeaderStyle-Width="30px"></telerik:TreeListButtonColumn>
                <telerik:TreeListBoundColumn DataField="EmployeeID" HeaderText="ID" ReadOnly="true" UniqueName="EmployeeID" HeaderStyle-Width="60px" ForceExtractValue="Always"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="LastName" HeaderStyle-Width="75px"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="FirstName" HeaderStyle-Width="75px"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="TitleOfCourtesy" HeaderText="Title" UniqueName="Title" HeaderStyle-Width="60px"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="Notes" HeaderText="Notes" UniqueName="Notes" HeaderStyle-Width="280px"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="ReportsTo" HeaderText="ReportsTo" HeaderStyle-Width="60px" ReadOnly="true" ForceExtractValue="Always"></telerik:TreeListBoundColumn>
            </Columns>
        </telerik:RadTreeList>
    </telerik:RadAjaxPanel>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance