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

InputManger EmptyMessage returned when getting .Text property of textbox

3 Answers 55 Views
Input
This is a migrated thread and some comments may be shown as answers.
Waylon Campbell
Top achievements
Rank 1
Waylon Campbell asked on 03 Nov 2010, 04:47 PM
<telerik:RadInputManager ID="radInputManager1" runat="server">
     <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior" EmptyMessage="######"
            InitializeOnClient="false" Type="Number" DecimalDigits="0" GroupSeparator="" Validation-IsRequired="false">
    </telerik:NumericTextBoxSetting>
</telerik:RadInputManager>


I apply the setting to a textbox in code-behind.  When I don't enter a value in the textbox, the Text property of the textbox returns the inputmanager setting's EmptyMessage, "######".  I would expect the Text property to return what was input in the control, in this case an empty string,  not the emptymessage.  Is there a way to accomplish this?

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 03 Nov 2010, 06:14 PM
Hi Waylon,

The observed behavior should not occur. I suggest you to check for Javascript errors.

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server">
 
    protected void Page_Load(object sender, EventArgs e)
    {
        radInputManager1.GetSettingByBehaviorID("NumericBehavior").TargetControls.Add(new TargetInput("TextBox1", true));
 
        if (IsPostBack)
        {
            Label1.Text = TextBox1.Text;
        }
    }
     
</script>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadInputManager ID="radInputManager1" runat="server">
     <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior" EmptyMessage="######"
            InitializeOnClient="false" Type="Number" DecimalDigits="0" GroupSeparator="" Validation-IsRequired="false">
    </telerik:NumericTextBoxSetting>
</telerik:RadInputManager>
 
<p>Leave the textbox with no value and submit</p>
 
<asp:TextBox ID="TextBox1" runat="server" />
 
<br /><br />
 
<asp:Button ID="Button1" runat="server" Text="Submit" />
 
<br /><br />
 
textbox value: [<asp:Label ID="Label1" runat="server" />]
 
 
</form>
</body>
</html>


Greetings,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Waylon Campbell
Top achievements
Rank 1
answered on 03 Nov 2010, 10:11 PM
So it appears that I get the correct value in the page load event, but not in the button click event.  In my application, the textbox is inside the form template of a radgrid and I need to get the value on insert/update, so I really need access outside of the page load event.

<%@ Page Language="C#" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<script runat="server">
  
    protected void Page_Load(object sender, EventArgs e)
    {
        radInputManager1.GetSettingByBehaviorID("NumericBehavior").TargetControls.Add(new TargetInput("TextBox1", true));
    }
 
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = TextBox1.Text;
    }
      
</script>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  
<head id="Head1" runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
  
<telerik:RadInputManager ID="radInputManager1" runat="server">
     <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior" EmptyMessage="######"
            InitializeOnClient="false" Type="Number" DecimalDigits="0" GroupSeparator="" Validation-IsRequired="false">
    </telerik:NumericTextBoxSetting>
</telerik:RadInputManager>
  
<p>Leave the textbox with no value and submit</p>
  
<asp:TextBox ID="TextBox1" runat="server" />
  
<br /><br />
  
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
  
<br /><br />
  
textbox value: [<asp:Label ID="Label1" runat="server" />]
  
  
</form>
</body>
</html>
0
Accepted
Dimo
Telerik team
answered on 04 Nov 2010, 10:06 AM
Hi Waylon Campbell,

I see. This is not an expected behavior indeed, and we will have to fix it. In the meantime, you can remove the empty message or retrieve the "real" submitted value like this:

Request.Form[TextBox1.ClientID]

I have updated your Telerik points for bringing the issue to our attention. Thank you.

Regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Input
Asked by
Waylon Campbell
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Waylon Campbell
Top achievements
Rank 1
Share this question
or