RadNumericTextbox clear value when outside of range

4 posts, 0 answers
  1. License
    License avatar
    41 posts
    Member since:
    Aug 2011

    Posted 05 Mar 2014 Link to this post

    How can I go about clearing the textbox when an entered value exceeds the min or max value instead of setting the value to the min or max?
  2. License
    License avatar
    41 posts
    Member since:
    Aug 2011

    Posted 05 Mar 2014 Link to this post

    Just little more info...

    I am setting the limitations programmatically, so I can't really hard-code some values into a client-side function and check against that. I can't really tell what Client Events occur when the input is not within the range, but I would imagine that's the approach I would need to take here.
  3. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Mar 2014 in reply to License Link to this post

    Hi Robert,

    One Suggestion is that you can programmatically find a range for RadNumericTextBox and assign those values in HiddenField, then compare those values with the RadNumericTextBox value in OnValueChanged event. Please have a look into the sample code snippet which works fine at my end.

    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" ClientEvents-                           OnValueChanged="OnValueChanged">
    <asp:HiddenField ID="MinValue" runat="server" />
    <asp:HiddenField ID="MaxValue" runat="server" />

    <script type="text/javascript">
        function OnValueChanged(sender, args) {
            //programatically set a maximum value and minimum value to the hidden fields
            var max = document.getElementById("MaxValue").value;
            var min = document.getElementById("MinValue").value;
            if (args.get_newValue() < min && args.get_newValue() > max)

    Let me know if you have any concern.
  4. Vasil
    Vasil avatar
    1642 posts

    Posted 06 Mar 2014 Link to this post

    Hello Robert,

    You can also set AllowOutOfRangeAutoCorrect="true" as alternative. In this case the input will be shown as invalid without auto-correcting the value.


    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Back to Top