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

Keep trailing zero with Radinputmanager during ajax call

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

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

thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 10 Nov 2010, 02:31 PM
Hi OPL,

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" />
<title>RadControls</title>
</head>
<body>
<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">
        <TargetControls>
            <telerik:TargetInput ControlID="TextBox1" />
        </TargetControls>
    </telerik:NumericTextBoxSetting>
</telerik:RadInputManager>
 
<script type="text/javascript">
 
Telerik.Web.UI.RadNumericTextBoxExtender.prototype._beforeSubmit = function()
{
    this._owner._inputs[this._id]._focused = false;
         
    return true;
}
 
</script>
 
</form>
</body>
</html>


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