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

Start Number in RadNumericTextBox

2 Answers 61 Views
Input
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 13 May 2014, 02:12 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 May 2014, 04:46 AM
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.
0
Glenn
Top achievements
Rank 1
answered on 13 May 2014, 08:09 AM
Perfect.  Thanks Shinu
Tags
Input
Asked by
Glenn
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Glenn
Top achievements
Rank 1
Share this question
or