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

Radnumerictextbox

1 Answer 45 Views
Input
This is a migrated thread and some comments may be shown as answers.
woutercop
Top achievements
Rank 1
woutercop asked on 08 Sep 2010, 01:07 PM

I need to make a input numeric textbox where only thousands are allow, and minimum value 5000

for example 5000, 7000, 10.000, ....

if some gives in 7300 if has to be rounded to 7000, if 259200 to 259000 >> so rounded to the nearest 1000

i have tried to do the first step (check if it is a thousand) with a 

 <
telerik:radnumerictextbox MinValue="5000" ClientEvents-OnKeyPress="" Culture="nl-BE" id="txtBedrag" runat="server">  

 

<NumberFormat DecimalDigits="0" />

 

<ClientEvents OnValueChanged="OnValueChanged" />

 

 

 

</telerik:radnumerictextbox> 

 

 

 

 

 

 

 

<

 

script type="text/javascript">

 

 

 

 

 

function

 

OnValueChanged(sender, eventArgs)

 {

 

var number = aspnetForm.ctl00_ContentPlaceHolder1_txtBedrag_text.value;  

 

 

 

if (number % 1000 > 0)  

 

return false;

 }

 

</script>

 

 

 

 

but this doenst do anyhting, if someone can help me, please let me know !

thanks,
wouter

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 08 Sep 2010, 01:48 PM
Hello Wouter,

You should use the ValueChanging client event.

http://www.telerik.com/help/aspnet-ajax/input_clientsideonvaluechanging.html

You can check what is the value of the get_newValue() property in the event arguments and if necessary, set the modified value to the set_newValue() property (again in the event arguments).

Generally, the value of the RadInput textboxes should not be manipulated with DOM opeartions (e.g. some_id.value = something), but only by using client API methods, as demonstrated in the documentation.

Let me know if there is anything unclear.

Greetings,
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
woutercop
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or