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

Radnumerictextbox - value lost after pressing [enter] key

4 Answers 165 Views
Input
This is a migrated thread and some comments may be shown as answers.
Frank Beerens
Top achievements
Rank 1
Frank Beerens asked on 18 Jun 2013, 07:28 AM
Dear Telerik,

at the moment we experience an odd behaviour with the RadNumericTextBox component (version 2013.403.35).
In some situations the value on the server is lost. The situation is as following: we have a page with several controls, divided over different (multi)views. One view contains a grid, another view our inputform. The inputform consists of several controls, including a save button.
One such control is the RadNumericTextBox, with type=currency.

When a user enters a value in the box, and also presses the [enter] key, the following happens:
- client side nothing seems to happen, the cursor stays in the textbox (currency character does not show (yet) because the textbox still has the focus. Also form submit on enter has been disabled somehow, I think due another control on the page, like a grid. But this is ok :).
- once the user presses the save button, the value on the server seems to be lost. The value of the box is null.
- after the postback, on the client the value is lost as well

Our problem occurs in both IE and FF browser. I've been able to reproduce the problem in a small example project, but this only does display the behaviour in FF and not IE. But I think it is still a good lead to start with? I suspect it has something to do with the form not submitting, and the way it is prevented. See below for some example code. If you need the whole project, I can provide it.

The project is a simple webforms project with 1 page, Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body onkeydown="return (event.keyCode!=13)">
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1"></telerik:RadScriptManager>
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1"></telerik:RadAjaxManager>
        <telerik:RadNumericTextBox runat="server" ID="RadNumericTextBox1" Type="Currency"></telerik:RadNumericTextBox>
        <asp:Button runat="server" ID="btnNoPostback" UseSubmitBehavior="false" Text="Save" OnClick="btnNoPostback_Click" />
    </form>
</body>
</html>

Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void btnNoPostback_Click(object sender, EventArgs e)
    {
        RadAjaxManager1.Alert(string.Format("Button save clicked, value of RadNumericTextbox 1 is: {0}", RadNumericTextBox1.Value));
    }
}

To reproduce:
- run project in FireFox
- enter a value in the textbox, and press the [enter] key
- press the save button to show the value

Thanks in advance.






4 Answers, 1 is accepted

Sort by
0
Tina
Top achievements
Rank 2
answered on 18 Jun 2013, 05:38 PM
I have the exact same problem using the RadTextBox as well.
0
Chris
Top achievements
Rank 1
answered on 18 Jun 2013, 06:50 PM
I have a similar problem with 2013 Q2: i save programmatically the content of different controls (RadEditor etc.) in a page. Alle values are stored correct in the database, exceptionally values in radtextbox they are lost. This effect we have with firefox but not with ie. In 2013 Q1 the function of the same page was always correct.
0
Viktor Tachev
Telerik team
answered on 21 Jun 2013, 07:06 AM
Hello Frank,

There was such issue in version 2013.1.403. However, the problem has been fixed and is not present in the latest version (currently 2013.2.611). I tested your code with the latest version and the control works as expected on my side. The value on the server is not null after pressing the return key and then the Button.

Try using the latest version or the controls and the issue should not be present.

Chris, could you open a new forum thread or a support ticket and share your source code with the code-behind. This way if someone with similar problem is looking for a solution in the forum it would be easier for them to find it. Could you also elaborate more on the scenario you have? This way we could better understand your case and investigate the issue further. 

Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Frank Beerens
Top achievements
Rank 1
answered on 24 Jun 2013, 06:41 AM
Hi Viktor,

thanks. I can confirm the problem is indeed solved with the newer version.

Tags
Input
Asked by
Frank Beerens
Top achievements
Rank 1
Answers by
Tina
Top achievements
Rank 2
Chris
Top achievements
Rank 1
Viktor Tachev
Telerik team
Frank Beerens
Top achievements
Rank 1
Share this question
or