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

RadNumericTextBox cannot cope with int64 maxvalue

3 Answers 130 Views
Input
This is a migrated thread and some comments may be shown as answers.
Craig Wallace
Top achievements
Rank 1
Craig Wallace asked on 05 Sep 2013, 03:18 PM
How can I set up a RadNumericTextBox to cope with the full range of an int64?

I currently have:
<telerik:RadNumericTextBox ID="RadNumericTextBox1" DataType="System.Int64"
            runat="server" Culture="en-US" EnableSingleInputRendering="True"
            LabelWidth="64px" MaxValue="9223372036854775807" MinValue="0">
<NumberFormat ZeroPattern="n" AllowRounding="False" DecimalDigits="0" GroupSeparator=""></NumberFormat>
        </telerik:RadNumericTextBox>

According to MSDN,the maxvalue of int64 is 9223372036854775807.

It appears to be impossible to configure a RadNumericTextBox to accept and return this number.

If you set DataType="System.Int64" and enter 9223372036854775807, the control changes it to 9223372036854776000.

If you try and read back 9223372036854776000 then .DbValue throws an overflowexception, and .Text returns "9.22337203685478E+18".

Does RadNumericTextBox support int64 or not?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 10 Sep 2013, 07:07 AM
Hi Craig,

RadNumericTextBox works internally with double both Client and Server side, because in JavaScript there is no int64 type.

From Q2 2013 you can use RadMaskedTextBox with Int64(long) mask to populate such values. See more in this help topic:
http://www.telerik.com/help/aspnet-ajax/input-maskedtextbox-masks.html

The MaskedTextBox works with string internally, and the parsing of long is implemented in the control itself, without relying on the JavaScript primary float type.

Regards,
Vasil
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
Craig Wallace
Top achievements
Rank 1
answered on 23 Oct 2013, 10:04 AM
Hi Vasil,

Can you provide a code sample illustrating how this situation should work with RadControls?

I.e., A user can enter 9223372036854775807 but cannot enter 9223372036854775808.

Thanks,

Craig

0
Vasil
Telerik team
answered on 23 Oct 2013, 12:13 PM
Hi Craig,

Here is an example:
<telerik:RadMaskedTextBox runat="server" ID="RadMaskedTextBox1" Width="200px"
    Mask="<0...9223372036854775807>">
</telerik:RadMaskedTextBox>


Regards,
Vasil
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.
Tags
Input
Asked by
Craig Wallace
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Craig Wallace
Top achievements
Rank 1
Share this question
or