Silk skin

Grid - Automatic Operations

Next database reset in 1 hours, 9 minutes, 41 seconds
 ContactNameCompanyNameContactTitlePhone 
Page size:
 82 items in 9 pages
Art BraunschweigerSplit Rail Beer & AleSales Manager(307) 555-4680
Bernardo BatistaQue DelíciaAccounting Manager(21) 555-4252
Carine SchmittFrance restaurationMarketing Manager40.32.21.21
Carlos GonzálezLILA-SupermercadoAccounting Manager(9) 331-6954
Carlos HernándezHILARION-AbastosSales Representative(5) 555-1340
Catherine DeweyMaison DeweySales Agent(02) 201 24 67
Christina BerglundBerglunds snabbköpOrder Administrator0921-12 34 65
Daniel ToniniLa corne d'abondanceSales Representative30.59.84.10
Diego RoelFISSA Fabrica Inter. Salchichas S.A.Accounting Manager(91) 555 94 44
Dominique PerrierSpécialités du mondeMarketing Manager(1) 47.55.60.10
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

The current ASP.NET Grid example demonstrates RadGrid's capability for inserting new data, updating existing data and deleting data against an EntityDataSource. The only thing that is required of you is to configure the entity data source by incuding the correpsonding database tables in the entity data model and set the following properties of the grid to true to propagate automatic update/insert/delete operations:

  • AllowAutomaticUpdates
  • AllowAutomaticInserts
  • AllowAutomaticDeletes

What is on this example:
  • You can insert a new item using the [Add new record] button in the Command row.
  • You can edit an item using the Edit button (the first button in each row).
  • You can delete an item, using the Delete button (at the end of each row).

You may also see how to utilize Telerik OpenAccess ORM as a data access layer for our AJAX controls by visiting the OpenAccess ORM live demos here.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Language="VB" CodeFile="DefaultVB.aspx.vb" Inherits="defaultvb"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />
    <div id="demo" class="demo-container no-bg">
        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" DataSourceID="EntityDataSourceCustomers"
            AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
            AllowAutomaticDeletes="true" AllowSorting="true" OnItemCreated="RadGrid1_ItemCreated"
            OnItemInserted="RadGrid1_ItemInserted" OnPreRender="RadGrid1_PreRender" OnInsertCommand="RadGrid1_InsertCommand">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView DataSourceID="EntityDataSourceCustomers" AutoGenerateColumns="False"
                DataKeyNames="CustomerID" CommandItemDisplay="Top">
                <Columns>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
                        UniqueName="CustomerID" Visible="false" MaxLength="5">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName"
                        UniqueName="ContactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName"
                        UniqueName="CompanyName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle"
                        UniqueName="ContactTitle">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" SortExpression="Phone"
                        UniqueName="Phone">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    <asp:EntityDataSource ID="EntityDataSourceCustomers" runat="server" ConnectionString="name=NorthwindReadWriteEntities"
        DefaultContainerName="NorthwindReadWriteEntities" EntitySetName="Customers" OrderBy="it.[ContactName]"
        EntityTypeFilter="Customer" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True">
    </asp:EntityDataSource>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?