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

Input / Settings per data bound control

DateInputSetting
 OrderDate
 
7/5/1996
7/8/1996
NumericTextBoxSetting
 Freight
 
$11.61
$65.83
TextBoxSetting
 ShipAddress
 
Luisenstr. 48
Rua do Paço, 67
RegExpTextBoxSetting
 Phone
 
(503) 555-3199
(503) 555-9931

  • This demo illustrates how to define input settings for all textboxes inside a data bound control (RadGrid in this case). All you need to do is specify the id of the data bound control (grid, repeater, data list, etc.) through the TargetInput -> ControlID property of the respective RadInputManager setting.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true" Inherits="Telerik.InputExamplesCS.Input.Examples.RadTextBox.FirstLook.DefaultCS" %>

    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
    <%@ 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">
        <qsf:HeadTag ID="Headtag1" runat="server"></qsf:HeadTag>
    </head>
    <body class="BODY">
        <form id="mainForm" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#"></qsf:Header>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <!-- content start -->
        <telerik:RadInputManager ID="RadInputManager1" runat="server">
            <telerik:DateInputSetting EmptyMessage="Order date" Culture="English (United States)"
                InitializeOnClient="true" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy">
                <TargetControls>
                    <telerik:TargetInput ControlID="RadGrid1" />
                </TargetControls>
            </telerik:DateInputSetting>
            <telerik:NumericTextBoxSetting Type="Currency" EmptyMessage="Freight" Culture="English (United States)"
                InitializeOnClient="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="RadGrid2" />
                </TargetControls>
            </telerik:NumericTextBoxSetting>
            <telerik:TextBoxSetting EmptyMessage="Ship Address" InitializeOnClient="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="RadGrid3" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:RegExpTextBoxSetting EmptyMessage="U.S. Phone Number" ErrorMessage="Invalid U.S. Phone Number"
                InitializeOnClient="true" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">
                <TargetControls>
                    <telerik:TargetInput ControlID="RadGrid4" />
                </TargetControls>
            </telerik:RegExpTextBoxSetting>
        </telerik:RadInputManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid3">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid3" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid4">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid4" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <div class="module">
            <table border="0">
                <tr>
                    <td style="padding: 30px">
                        DateInputSetting
                        <telerik:RadGrid DataSourceID="SqlDataSource1" ID="RadGrid1" runat="server" AutoGenerateColumns="False"
                            Width="300px">
                            <MasterTableView AllowAutomaticUpdates="true" Width="100%" DataKeyNames="OrderID"
                                EditMode="InPlace">
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                                    <telerik:GridBoundColumn DataFormatString="{0:d}" UniqueName="OrderDate" HeaderText="OrderDate"
                                        DataField="OrderDate">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"

                            SelectCommand="SELECT TOP 3 [OrderID], [OrderDate] FROM [Orders]"
                            UpdateCommand="UPDATE [Orders] SET [OrderDate] = @OrderDate WHERE [OrderID] = @OrderID">
                            <UpdateParameters>
                                <asp:Parameter Name="OrderDate" Type="DateTime" />
                                <asp:Parameter Name="OrderID" Type="Int32" />
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </td>
                    <td style="padding: 30px">
                        NumericTextBoxSetting
                        <telerik:RadGrid DataSourceID="SqlDataSource2" ID="RadGrid2" runat="server" AutoGenerateColumns="False"
                            Width="300px">
                            <MasterTableView AllowAutomaticUpdates="true" Width="100%" DataKeyNames="OrderID"
                                EditMode="InPlace">
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                                    <telerik:GridBoundColumn DataFormatString="{0:C}" UniqueName="Freight" HeaderText="Freight"
                                        DataField="Freight">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"

                            SelectCommand="SELECT TOP 3 [OrderID], [Freight] FROM [Orders]"
                            UpdateCommand="UPDATE [Orders] SET [Freight] = @Freight WHERE [OrderID] = @OrderID">
                            <UpdateParameters>
                                <asp:Parameter Name="Freight" Type="Decimal" />
                                <asp:Parameter Name="OrderID" Type="Int32" />
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td style="padding: 30px">
                        TextBoxSetting
                        <telerik:RadGrid DataSourceID="SqlDataSource3" ID="RadGrid3" runat="server" AutoGenerateColumns="False"
                            Width="300px">
                            <MasterTableView AllowAutomaticUpdates="true" Width="100%" DataKeyNames="OrderID"
                                EditMode="InPlace">
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                                    <telerik:GridBoundColumn UniqueName="ShipAddress" HeaderText="ShipAddress" DataField="ShipAddress">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"
    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"

                            SelectCommand="SELECT TOP 3 [OrderID], [ShipAddress] FROM [Orders]"
                            UpdateCommand="UPDATE [Orders] SET [ShipAddress] = @ShipAddress WHERE [OrderID] = @OrderID">
                            <UpdateParameters>
                                <asp:Parameter Name="ShipAddress" Type="String" />
                                <asp:Parameter Name="OrderID" Type="Int32" />
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </td>
                    <td style="padding: 30px">
                        RegExpTextBoxSetting
                        <telerik:RadGrid DataSourceID="SqlDataSource4" ID="RadGrid4" runat="server" AutoGenerateColumns="False"
                            Width="300px">
                            <MasterTableView DataKeyNames="ShipperID" AllowAutomaticUpdates="true" Width="100%"
                                EditMode="InPlace">
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                                    <telerik:GridBoundColumn UniqueName="Phone" HeaderText="Phone" DataField="Phone">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server"
    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"

                            SelectCommand="SELECT TOP 3 [ShipperID], [Phone] FROM [Shippers]"
                            UpdateCommand="UPDATE [Shippers] SET [Phone] = @Phone WHERE [ShipperID] = @ShipperID">
                            <UpdateParameters>
                                <asp:Parameter Name="Phone" Type="String" />
                                <asp:Parameter Name="ShipperID" Type="Int32" />
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
            </table>
        </div>
        <!-- content end -->
        <qsf:Footer ID="Footer1" runat="server"></qsf: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