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

MaxLength for RadNumericUpDown

6 Answers 428 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Lauren Nickerson
Top achievements
Rank 1
Lauren Nickerson asked on 13 Jul 2009, 09:16 PM
Hello, is it possible to set a MaxLength to the RadNumericUpDown so the user can't input more than the allowed number? (Exactly like the WPF TextBox), I tried the code below but it didn't work since ContentText is readonly:

private

 

void textBoxWidth_KeyDown(object sender, KeyEventArgs e)

 

{

 

    if (textBoxWidth.ContentText.Length > 1)

 

    {

        textBoxWidth.ContentText = 9;

        textBoxWidth.Value = 9;

    }

}

Thanks.

6 Answers, 1 is accepted

Sort by
0
Hristo Borisov
Telerik team
answered on 16 Jul 2009, 03:07 PM
Hello Lauren Nickerson,

Why would you need this functionality? If you have specified the number of digits of your input for example to 2, which is the default behavior, your value won't be rounded to this precision. Would you explain in more details the reason you want to constrain the text, so we can evaluate your scenario for a possible feature. Thank you for contacting us and we look forward to receiving your feedback.

All the best,
Hristo Borisov
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.
0
Sav
Top achievements
Rank 1
answered on 08 Dec 2011, 11:08 AM
Hello...

It would be goog, if lenght could be set and Its not about rounding. Firstly, it looks good when user cannot exceed lets say four digit number, because width is set and longer text will start to hide. Ther other thing is, that you may accidentally enter one extra digit beyond digit number of maximum value. The result is that if wanted to enter for example 333, and by mishap entered 3333, the value automaticaly jumps to maximum which is somthing like 999 or whatever else. User might miss that change, especially when lost focus is due to 'Submit' button click...      

So I would add that funcionality. 


Bye.
0
Boyan
Telerik team
answered on 12 Dec 2011, 04:02 PM
Hello Sav,

Thank you for your feedback. You are right that sometimes this is a little bit confusing and not very user friendly. I have logged your request in our PITS system with ID8833. You can follow its progress and vote for this feature.

As a workaround you can use RadMaskedTextBox if you don't need the up and down arrows, there you can use a mask with fixed number of digits.

All the best,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Christian
Top achievements
Rank 1
answered on 07 Aug 2013, 09:21 AM
The Issue has been aborted. Can you please tell me why? I wanted to vote for it...
0
Konstantina
Telerik team
answered on 08 Aug 2013, 01:36 PM
Hello Christian,

The item is very old and it didn't have enough demand, so we decided to delete it. However, this still can be achieved by editing the style of the NumericUpDown control. Inside is the TextBox, which displays the number and you could set its MaxLength property to limit the input.

Regards,
Konstantina
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
1
Jayesh
Top achievements
Rank 1
answered on 31 Aug 2018, 12:07 PM
<telerik:RadNumericUpDown.Resources>
  <Style TargetType="{x:Type TextBox}">
      <Setter Property="MaxLength" Value="6"/>
  </Style>
</telerik:RadNumericUpDown.Resources>
Tags
NumericUpDown
Asked by
Lauren Nickerson
Top achievements
Rank 1
Answers by
Hristo Borisov
Telerik team
Sav
Top achievements
Rank 1
Boyan
Telerik team
Christian
Top achievements
Rank 1
Konstantina
Telerik team
Jayesh
Top achievements
Rank 1
Share this question
or