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

RadNumericTextBox clear() method doesn't work

1 Answer 118 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sabrina
Top achievements
Rank 1
Sabrina asked on 17 Apr 2009, 03:27 PM
Hello,

I try to clear the value of a RadNumericTextBox.

I write :

<telerik:RadNumericTextBox ID="RedemptionRightException" MinValue="0" MaxValue="100" 
    
EnableEmbeddedSkins="false" runat="server" ForeColor="Red" MinValue="0">
    <ClientEvents OnError="ErrorPercent" /> 
</telerik:RadNumericTextBox> 

function ErrorPercent(sender, args)     
{  
 alert('value is not correct');          
 sender.clear();  
 return false;  
}   

But the value after the clear is 100.

Can you help me ?

Thanks,

Sabrina

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Apr 2009, 06:08 PM
Hello Sabrina,

Try the following approach:
<script type="text/javascript" language="javascript"
    function valueChanging(sender, args) 
    { 
        if (!isNaN(args.get_newValue())) 
        { 
            args.set_cancel(true); 
            alert('value is not correct'); 
            args.set_newValue(); 
        } 
    }    
</script> 

<telerik:RadNumericTextBox ID="rntb1" runat="server" MinValue="100" MaxValue="200"
    <ClientEvents OnValueChanging="valueChanging" /> 
</telerik:RadNumericTextBox> 

Let us know whether this helps.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Input
Asked by
Sabrina
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or