Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q1 2012 released 04/11/2012
select

Ajax / Dynamic ajax settings

     Add new employee                    Delete selected employee                    Refresh employees list
AndrewFullerVice President, SalesDr.02/19/1952
JanetLeverlingSales RepresentativeMs.08/30/1963
MargaretPeacockSales RepresentativeMrs.09/19/1937
StevenBuchananSales ManagerMr.03/04/1955
MichaelSuyamaSales RepresentativeMr.07/02/1963
RobertKingSales RepresentativeMr.05/29/1960
LauraCallahanInside Sales CoordinatorMs.01/09/1958
AnneDodsworthSales RepresentativeMs.01/27/1966

    • Click the Edit icon in a grid row to edit its date in an external form
    • Click the 'Add new employee' button in the command item to insert a new grid row through an external form
    • Delete grid items by either selecting them and clicking the 'Delete selected employee' in the command item or pressing the 'Delete' button from the external form when editing a row

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" CodeFile="defaultcs.aspx.cs" AutoEventWireup="false" Inherits="Telerik.AJAXExamplesCSharp.AJAX.Examples.Manager.DynamicAjaxSettings.DefaultCS" %>

    <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register Src="EmployeesGridCS.ascx" TagName="EmployeesGrid" TagPrefix="uc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <telerik:HeadTag ID="Headtag1" runat="server"></telerik:HeadTag>
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
        <telerik:Header ID="Header1" runat="server" NavigationLanguage="C#" ShowSkinChooser="true" />
        <!-- content start -->
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
                function ProcessDelete() {
                    //get reference to the client grid object using the global window variable set in the user control's Page_Load server handler
                    var grid = $find(window['gridId']);

                    if (grid.get_masterTableView().get_selectedItems().length > 0) {
                        if (confirm('Are you sure you want to delete this employee?')) {
                            return true;
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        radalert('You must select a grid row first before processing delete');
                        return false;
                    }
                }
                function ProcessUpdate() {
                    //get reference to the client grid object using the global window variable set in the user control's Page_Load server handler
                    var grid = $find(window['gridId']);
                    var btnDelete = $get('btnDelete');

                    if ((btnDelete.style.display == "none") || grid.get_masterTableView().get_selectedItems().length > 0) {
                        return true;
                    }
                    else {
                        radalert('You must select a grid row first before processing update');
                        return false;
                    }
                }
            </script>

        </telerik:RadCodeBlock>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxSettingCreating="RadAjaxManager1_AjaxSettingCreating">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnSaveChanges">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="DivExternalForm" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnDelete">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="DivExternalForm" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" />
        <uc1:EmployeesGrid ID="EmployeesGrid1" runat="server" />
        <div style="border: 1px solid threedshadow;" id="DivExternalForm" runat="server">
            <asp:Panel ID="pnlExternalForm" runat="server" Visible="false">
                <table border="0" style="margin-top: 20px; width: 100%;">
                    <tr>
                        <td style="width: 100px;">
                            Employee ID:
                        </td>
                        <td>
                            <asp:Label ID="EmployeeID" Style="float: left; font-weight: bold;" runat="server" />
    <asp:Button ID="btnSaveChanges" Style="float: right; color: black; font-weight: bold;"
    Text="Save" runat="server" OnClientClick="if(!ProcessUpdate()) return false;"
    OnClick="SaveChanges_Click" />

    <asp:Button ID="btnDelete" Style="float: right; margin-right: 10px; color: black;
    font-weight: bold;" OnClientClick="if(!ProcessDelete()) return false;" Text="Delete"
    runat="server" OnClick="Delete_Click" />

                        </td>
                    </tr>
                    <tr>
                        <td>
                            Last name:
                        </td>
                        <td>
                            <telerik:RadTextBox ID="LastName" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            First name:
                        </td>
                        <td>
                            <telerik:RadTextBox ID="FirstName" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Title:
                        </td>
                        <td>
                            <telerik:RadTextBox ID="Title" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Title of courtesy:
                        </td>
                        <td>
                            <telerik:RadComboBox ID="TitleOfCourtesy" runat="server">
                                <Items>
                                    <telerik:RadComboBoxItem Text="" Value="" />
                                    <telerik:RadComboBoxItem Text="Dr." Value="Dr." />
                                    <telerik:RadComboBoxItem Text="Mr." Value="Mr." />
                                    <telerik:RadComboBoxItem Text="Mrs." Value="Mrs." />
                                    <telerik:RadComboBoxItem Text="Ms." Value="Ms." />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Birth date:
                        </td>
                        <td>
                            <telerik:RadDatePicker ID="BirthDate" MinDate="01/01/1900" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top;">
                            Notes:
                        </td>
                        <td style="height: 300px; vertical-align: top;">
                            <telerik:RadEditor ID="Notes" Width="400px" runat="server" Height="250px">
                                <Tools>
                                    <telerik:EditorToolGroup>
                                        <telerik:EditorTool Name="Italic" />
                                        <telerik:EditorTool Name="Bold" />
                                        <telerik:EditorTool Name="Underline" />
                                        <telerik:EditorTool Name="StrikeThrough" />
                                        <telerik:EditorTool Name="JustifyLeft" />
                                        <telerik:EditorTool Name="JustifyCenter" />
                                        <telerik:EditorTool Name="JustifyRight" />
                                        <telerik:EditorTool Name="JustifyFull" />
                                    </telerik:EditorToolGroup>
                                </Tools>
                            </telerik:RadEditor>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </div>
        <!-- content end -->
        <telerik:Footer runat="server" ID="Footer1"></telerik:Footer>
        </form>
    </body>
    </html>

Get more than expected!

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2012 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451