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

RadGrid (GridTemplateColumn + RadNumericTextBox) Wrong Value

3 Answers 236 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Murilo Savi
Top achievements
Rank 1
Murilo Savi asked on 27 Mar 2014, 08:50 PM
I have a grid and within your GridTemplateColumn have a RadNumericTextBox that can be edited. The problem that when I edit a field and press TAB (to go below the line), the value was 1459,14 145914,00 is if I go back into the field above to change the value of the first line, the second line changes again and is 14591400,00 . 
I have attached an example with fictitious data in a list.

Put the DLLs in the file in the bin folder, I removed because the file was too large, making it impossible to upload.

Version: UI for ASP.NET AJAX Q3 2013

* Change the extension from. Jpg to. Rar

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 01 Apr 2014, 12:53 PM
Hello Murilo,

The reason for that behavior is that you are using a comma as decimal separator and on the server you are using a culture where the decimal separator is dot. This way the comma is ignored and the value is increase with two zeros. A possible solution is to call blur on a TAB key click and after the postback to focus the next TextBox. Please check out the following code snippet.
Mark-Up:
<telerik:GridTemplateColumn UniqueName="gtcValor" HeaderText="Valor">
    <ItemTemplate>
        <telerik:RadNumericTextBox ID="txtValor" DataFormatString="{0:C2}" NumberFormat-AllowRounding="true"
            NumberFormat-KeepNotRoundedValue="true" AllowOutOfRangeAutoCorrect="false"
            runat="server" DbValue='<%# Eval("valor") %>' onkeydown="blurTextBox(this, event)"
            AutoPostBack="true" Width="99%" MaxLength="11" Type="Number">
            <NumberFormat DecimalDigits="2"  KeepTrailingZerosOnFocus="true" />
        </telerik:RadNumericTextBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>
JavaScript:
<script type="text/javascript">
    function blurTextBox(sender, event) {
        if (event.keyCode == 9) {
            $telerik.cancelRawEvent(event);
            sender.blur();
        }
    }
</script>

Regards,
Kostadin
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Murilo Savi
Top achievements
Rank 1
answered on 01 Apr 2014, 05:13 PM
Thanks for the replies! 

I have included the culture in my application, in web.config (<globalization culture="pt-BR" uiCulture="pt" />) ... Here in Brazil we use the format 1.254,25 
After the change, the first time it happens that TAB is pressed, the problem happens (1.254,25 goes to 125.425,00), the second does not happen anything. 

I believe that culture is correct, because my GRID is translated to pt-BR. 

In Control windows panel ... decimal = "," and group = "." 

I tried javascript but the problem sometimes happens when I use the mouse.
0
Kostadin
Telerik team
answered on 04 Apr 2014, 07:40 AM
Hello Murilo,

I logged this as a bug in our system and I already forward it to one of our developers for further investigation. You could track the progress in our Ideas&Feedback portal.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Murilo Savi
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Murilo Savi
Top achievements
Rank 1
Share this question
or