I have a RadNumericTextbox on a page that is set to display 2 decimal places.
If I set the initial value in the Page_Load to be 16.67 and then increase this value using the up arrow the control behaves as expected.
If I decrement this value below the initial 16.67 then the number suddenly displays 15,670000000000001 (15 decimal places), if I increment the number back to 16.67 or greater the decimal places displayed returns to 2.
I have tracked this down to the "AllowRounding" property, if set to false this behaviour occurs, if set to True the control behaves as expected.
Why is this happening? I need to set AllowRounding = false and do not want these additional decimal places.
Here is a simple test page which displays the behaviour:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="ScriptManager1">
</asp:ScriptManager>
<telerik:RadNumericTextBox ID="txtNum" ButtonsPosition="Right" MinValue="0" MaxValue="100" Type="Number" runat="server" ShowSpinButtons="true" >
<NumberFormat AllowRounding="false" DecimalDigits="2" />
<IncrementSettings Step ="1" />
</telerik:RadNumericTextBox>
</form>
</body>
</html>
using
System;
using
Telerik.Web.UI;
public
partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtNum.Value=16.67;
}
}