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

[Solved] NumericType Change by JavaScript

2 Answers 179 Views
Input
This is a migrated thread and some comments may be shown as answers.
Baatezu
Top achievements
Rank 2
Baatezu asked on 15 Apr 2008, 03:05 AM
Is it possible to change the numeric type through javascript?

2 Answers, 1 is accepted

Sort by
0
Baatezu
Top achievements
Rank 2
answered on 15 Apr 2008, 09:51 AM
I did a(n obvious) work around - created a second radNumeric and wrapped them both in panels and just have the panel display (inline:none) swapped.

Still interested if it is possible though.
0
Steve
Telerik team
answered on 15 Apr 2008, 10:02 AM
Hi Baatezu,

It is possible but with an ugly "hack" kind of way. Here is a sample code:

 <script type="text/javascript">
        function ChangeType()
        {
            var numeric1 = $find("<%=RadNumericTextBox1.ClientID %>");
            numeric1.get_numberFormat().NegativePattern = "-n %";
            numeric1.get_numberFormat().PositivePattern = "n %";
        }
    </script>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadNumericTextBox ID="RadNumericTextBox1" Type="Currency" runat="server"
           Width="125px" Culture="English (United States)">
            <NumberFormat AllowRounding="True" />
        </telerik:RadNumericTextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ChangeType(); return false;" />

More info on Negative/Positive Pattern can be found in this example.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Input
Asked by
Baatezu
Top achievements
Rank 2
Answers by
Baatezu
Top achievements
Rank 2
Steve
Telerik team
Share this question
or