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

Keep trailing zero with Radinputmanager during ajax call

1 Answer 38 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
OPL asked on 07 Nov 2010, 10:37 AM

I'm using RadinputManager in Radgrid.
During grid postback, trailing decimal zero are removed and reappear after.
Is there a way to keep them  ?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 10 Nov 2010, 02:31 PM

By design RadInputManager changes the formatted numeric values to unformatted numeric values on the fly during postbacks and AJAX requests. The following demo shows how to override this behavior, but keep in mind that this may cause undesired side effects and we do not claim it will work well in all scenarios. For example, the decimal separator in the textbox (i.e. the one defined in the NumericTextBoxsetting) must match the server-side decimal separator of the setting's culture, otherwise the values will not be persisted correctly across postbacks.

The Javascript code must be included in a <script> tag or registered in an external JS file in the <body>, so that it overrides the control's embedded scripts.

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Submit" />
<telerik:RadInputManager ID="RadInputManager1" runat="server">
    <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" DecimalDigits="3">
            <telerik:TargetInput ControlID="TextBox1" />
<script type="text/javascript">
Telerik.Web.UI.RadNumericTextBoxExtender.prototype._beforeSubmit = function()
    this._owner._inputs[this._id]._focused = false;
    return true;

Best wishes,
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
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question