TextBoxSetting control loosing value on Postback when disabled.

3 posts, 0 answers
  1. BrianS
    BrianS avatar
    25 posts
    Member since:
    Sep 2006

    Posted 24 Jan 2011 Link to this post

    When you have a asp.net textbox control defined in RadInputManager as TextBoxSetting and

    If you disable the textbox control client-side prior to postback, the value is lost on postback.

    Consider the following code:
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     
    <script runat="server">
     
        protected void btnGo_Click(object sender, EventArgs e)
        {
            Response.Write(tbPayeeLine1.Text);
        }
    </script>
     
    <head id="Head1" runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>RadControls for ASP.NET AJAX</title>
          
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
      
    <telerik:RadInputManager ID="RadInputManager1" runat="server">
     
        <telerik:TextBoxSetting BehaviorID="PayeeLine1Behavior" EmptyMessage="Enter Payee / Beneficiary Name Here" ErrorMessage="Payee/Beneficiary Required"
            Validation-IsRequired="true" Validation-ValidationGroup="ValGrpPayeeInfo">
            <TargetControls>
                <telerik:TargetInput ControlID="tbPayeeLine1" />
            </TargetControls>
        </telerik:TextBoxSetting>
        
    </telerik:RadInputManager>
     
    <asp:TextBox ID="tbPayeeLine1" name="payee" runat="server" MaxLength="33" Width="300px" />
    <asp:Button ID="btnDisable" runat="server" Text="Disable" OnClientClick="DisableTextBox();return false;"></asp:Button>
    <asp:Button ID="btnGo" runat="server" Text="Go" onclick="btnGo_Click"></asp:Button>
     
    <script type="text/javascript">
     
        function DisableTextBox() {
            debugger;
            var tb = $find("<%= RadInputManager1.ClientID %>").get_targetInput("<%= tbPayeeLine1.ClientID %>");
            //tb.disable()
            alert(tb.get_value());
            document.getElementById('<%= tbPayeeLine1.ClientID%>').disabled = true;
        }
      
    </script>
      
    </form>
    </body>
    </html>

  2. BrianS
    BrianS avatar
    25 posts
    Member since:
    Sep 2006

    Posted 24 Jan 2011 Link to this post

    I should mention dll version is 2010.3.1304.35.
  3. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 27 Jan 2011 Link to this post

    Hi Brian,

    You can observe the same behavior if you use a regular asp textbox when it is not extended with InputManager  - the value is not persisted on postback when the control is disabled.

    Kind regards,
    Pavel
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top