This is a migrated thread and some comments may be shown as answers.

TextBoxSetting control loosing value on Postback when disabled.

2 Answers 152 Views
Input
This is a migrated thread and some comments may be shown as answers.
BrianS
Top achievements
Rank 1
BrianS asked on 24 Jan 2011, 09:04 PM
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 Answers, 1 is accepted

Sort by
0
BrianS
Top achievements
Rank 1
answered on 24 Jan 2011, 09:05 PM
I should mention dll version is 2010.3.1304.35.
0
Pavel
Telerik team
answered on 27 Jan 2011, 08:53 AM
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.
Tags
Input
Asked by
BrianS
Top achievements
Rank 1
Answers by
BrianS
Top achievements
Rank 1
Pavel
Telerik team
Share this question
or