Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > NumericUpDown > How to get the length of selected numbers?

Answered How to get the length of selected numbers?

Feed from this thread
  • Kevin avatar

    Posted on Dec 3, 2009 (permalink)

    I need a way to find out what is the selected length when user highlights number in NumericUpDown control.

    Reply

  • Valeri Hristov Valeri Hristov admin's avatar

    Posted on Dec 4, 2009 (permalink)

    Hello Kevin,

    Unfortunately RadNumericUpDown does not provide a way to get/set the selection of its internal TextBox. You could try the following code:
    var textBox = RadNumericUpDown1.ChildrenOfType<TextBox>().FirstOrDefault();
    if (textBox != null)
    {
        // manupulate the selection here
    }

    but I strongly recommend using it only for testing purposes, since it might add performance penalty on your application.

    I will add this request to the product backlog and we will consider it for its future development.

    All the best,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Kevin avatar

    Posted on Dec 7, 2009 (permalink)

    Hello,

          I tried your sample code, but it always return the null. So I couldn't get the internal reference to TextBox.

        Thanks!

    -Kevin

    Reply

  • Answer Valeri Hristov Valeri Hristov admin's avatar

    Posted on Dec 8, 2009 (permalink)

    Hi Kevin,

    I suppose that you are trying to call my code too early, e.g. in a Loaded event or the page constructor - at this time the template of RadNumericUpDown is not applied yet and the TextBox is not created, hence the method returns an empty array. You could try the following:
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            this.RadNumericUpDown1.ApplyTemplate();
            var length = this.RadNumericUpDown1.ChildrenOfType<TextBox>()[0].SelectionLength;
        }
    }

    Regards,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Gabe avatar

    Posted on Apr 19, 2011 (permalink)

    IS there any update on this. I would like to have a better way to get the SelectedText for the NumericUpDown control.

    Reply

  • Valeri Hristov Valeri Hristov admin's avatar

    Posted on Apr 20, 2011 (permalink)

    Hello Gabe,

    This functionality has not changed and I still cannot set a specific delivery date for this feature.

    Kind regards,
    Valeri Hristov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > NumericUpDown > How to get the length of selected numbers?
Related resources for "How to get the length of selected numbers?"

Silverlight NumericUpDown Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]