Start Number in RadNumericTextBox

3 posts, 1 answers
  1. Glenn
    Glenn avatar
    47 posts
    Member since:
    Nov 2011

    Posted 12 May 2014 Link to this post

    Have 2 RadNumericTextBox's for user to input a min year and max year. 
    Have set MinValue as 1960 and MaxValue programmatically to current year (2014).
    ShowSpinButtons is set to TRUE.

    If a user chooses to use the spin buttons before entering a date, the text displays and starts at 1960. 
    In most cases the date to be set in the application is more likely to be user input between 2000 and 2014, however there will be times where the year input may go as low as 1960.  Is there anyway to set a start date of say 2000 (as oppose to 1960) for when the user selects the spin button?
    Obviously the MinValue would need to remain at 1960.

    It may even be more helpful to have a start value for the UP spin button (could be set at 2000) and a separate value for the DOWN button (could be set at 2014).

    Thanks

    Glenn


  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 May 2014 in reply to Glenn Link to this post

    Hi Glenn,

    Please try the following JavaScript  to achieve your scenario.

    ASPX:
    <telerik:RadNumericTextBox ID="radnumtxtMinvalue" runat="server" ShowSpinButtons="true">
        <ClientEvents OnButtonClick="setValue" />
    </telerik:RadNumericTextBox>

    JavaScript:
    <script type="text/javascript">
        function setValue(sender, args) {
            if (sender.get_value() == "") {
                if (args.get_buttonType() % 2 == 0) {
                    sender.set_value("1999");
                }
                else {
                    sender.set_value("2015");
                }
            }
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Glenn
    Glenn avatar
    47 posts
    Member since:
    Nov 2011

    Posted 13 May 2014 in reply to Shinu Link to this post

    Perfect.  Thanks Shinu
Back to Top