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

SelectedText

1 Answer 41 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 08 May 2012, 02:28 PM

How can I get the current selected text of the DateTimePicker? Not the Date or CurrentDateText - just the mouse selection. Like the TextBox.SelectedText.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivo
Telerik team
answered on 09 May 2012, 08:47 AM
Hi,

The best way to achieve this would be to inherit from the RadDateTimePicker control and to get the TextBox part of the control. Then you will be able to use its SelectedText property. Here is sample code:
public class DateTimePicker : RadDateTimePicker
{
    private TextBox textBoxPart;
 
    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
        this.textBoxPart = (TextBox)this.GetTemplateChild("PART_DateTimeInput");
    }
 
    public string SelectedText
    {
        get
        {
            return this.textBoxPart.SelectedText;
        }
    }
}

You can find a sample project attached.

Kind regards, Ivo
the Telerik team

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

Tags
DateTimePicker
Asked by
Oleg
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Share this question
or