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

Manual data editing

Next database reset in 0 hours, 51 minutes, 48 seconds
  IDLast NameFirst NameTitleNotesReportsTo
 24Check out the designJim5Dr.  
 27ljlwww12elkDr.  
 33erterttert   
 34yadavAm3 Kumar   
 35ttttttttttjk golden   
 36xxxxxxxxxxxxxxxx1   
 37BobBilly   
41HHHMrHH 
 42sdfgsdfg   
 43wqAAqwqq   
 45aa   
 46bbGbb   
 47weqwewrqewq   
 48eqewqwweqeqw   
 49sdadasdsadasdasdasdswrqewq   
 50DarioHernan   
 51FHJKJHFJFGJ555   
 52DarioHernan   
 53123123   
 54dddd444aaaa   
 55123123   
 56MeTesta   
 57aa   
 58BasPa   
 59dddd   
 60SmithTest   
 62aa   
 63TestTest   
 648555   
 6821e1e2e   
 69134   
 70yoolsofia   
 72GY   
 73ba   
 75aaaaaaaa   
 78testtest   
 79testtest   
 80pjpk   
 8211   
 831pk1   
 84da   
 8511   
 86jj   
 87cccccaaaa   
 88222222   
 89DSFGSDFGSDFGFDFDSG   
 90BobBilly   
 91Testth   
 92hhhgggDr.  
 9311   
 94sasdasdaasdas   
 95dasdaasdasd   
 96adasddasd   
 97tttt   
 98No nbvCm n en j   
 99ádassf   
 1022323Mr.  
 1032323   
 104121523   
 105121212   
 106111miguel   
 107asdasd   
 108 asdaasda   
 109aa   
 110ginanjardani   
 111bbbbbaaaaa   
 112xxxx   
 113edwardjames   
 114NameMy   
 118fff13231231   
 119rl   
 120ff   
 121hkheqjkehjqweqw   
 122SmithEd   

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