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

RadNumaricTextBox Numaric Length

4 Answers 34 Views
Input
This is a migrated thread and some comments may be shown as answers.
Kumar
Top achievements
Rank 1
Kumar asked on 15 Oct 2010, 12:47 PM
Hi,

I am using RadNumaricTextBox  in my project.

I am able to set decimal digits using    RadNumericTextBox.NumberFormat.DecimalDigits
similarli i want to set Numaric length
ex:If i set Numaric Length 4,and decimal 2 then the textbox allow only
1234.23

Is it possible

4 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 15 Oct 2010, 01:06 PM
Hello Kumar,

If you want to limit the user to only entering four digit numbers with two decimal places, you would set MinValue="1000.00" and MaxValue="9999.99".

I hope that helps.
0
Dimo
Telerik team
answered on 15 Oct 2010, 01:17 PM
Hello,

RadNumericTextBox does not support such a setup. You can use a RadMaskedTextBox with a Mask of

####.##

Regards,
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
0
Kumar
Top achievements
Rank 1
answered on 18 Oct 2010, 10:24 AM
Hi,

Thnaks for your reply.

I dont want to use maskedtextbox ,i want  to use numarictextbox only.
by setting MinValue="1000.00" and MaxValue="9999.99".
Hepls me,but it is not limiting the user to enter more than the max digits,after lost fous it is changing to linit range.
Ex:
I have set

RAdInputNumLength.NumberFormat.DecimalDigits=2
RAdInputNumLength.MaxValue=9999;

At run time user able to input 2343423.234234,but after lost focus it is adject to 9999.23

I want to restirct the user to not enter more than 4 numarical digits and 2 decimal disgits.
Help me



0
Dimo
Telerik team
answered on 20 Oct 2010, 06:10 PM
Hi Kumar,

Please inspect the following demo. Feel free to modify it according to your needs.

<%@ 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" />
 
<telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server">
    <ClientEvents OnKeyPress="MyKeyPress" />
</telerik:RadNumericTextBox>
 
<script type="text/javascript">
 
function MyKeyPress(sender, args)
{
    window.setTimeout(function()
    {
 
        var v = sender.get_textBoxValue();
 
        if (v.indexOf(".") == -1 && v.length > 4)
        {
            sender.set_textBoxValue(v.substr(0,4));
        }
 
        if (v.indexOf(".") != -1 && v.length > 7)
        {
            var parts = v.split(".");
            if (parts[0].length > 4)
            {
                parts[0] = parts[0].substr(0,4);
            }
            if (parts[1].length > 2)
            {
                parts[1] = parts[1].substr(0,2);
            }
            sender.set_textBoxValue(parts[0] + "." + parts[1]);
        }
 
    },1);
}
 
</script>
 
</form>
</body>
</html>


Kind regards,
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
Kumar
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Dimo
Telerik team
Kumar
Top achievements
Rank 1
Share this question
or