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

need to show empty date

4 Answers 365 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
rob mays
Top achievements
Rank 1
rob mays asked on 30 Jun 2008, 10:44 AM
When the datetimepicker loads I dont want any dates to be shown in the textbox please.

how do i do that?

4 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 02 Jul 2008, 01:43 PM
Hello rob mays,

RadDateTimePicker
has NullDate support. When you set its Value to its NullDate (NullDate by default is equal to the MinDate), the text you will see in RadDateTimePicker would be set to the NullText. NullText by default is an empty string.
  • In order to set the NullDate to a different date than the MinDate, you should set the NullDate of the DateTimePickerElement:
    this.radDateTimePicker1.DateTimePickerElement.NullDate = DateTime.Now; 
  • In order to set the value to NullDate, call the SetToNullValue method:
    this.radDateTimePicker1.DateTimePickerElement.SetToNullValue(); 

If you have additional questions, feel free to contact me.

Regards,

Nikolay
the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
0
rob mays
Top achievements
Rank 1
answered on 03 Jul 2008, 07:17 AM
many thanks for the response sorted it out for me. Well Done
0
Ed Molieri
Top achievements
Rank 1
answered on 11 Oct 2011, 07:36 PM
Hello,  I'm having the following issue:

When I trap the delete key on KeyDown I set DateTimePickerElement.SetToNullValue();  As expected the control's value disappears and the text box becomes blank.  The issue is that as soon as the control loses focus the old value re-displays. 

Please help. 
0
Peter
Telerik team
answered on 13 Oct 2011, 12:23 PM
Hi Eduardo Molieri,

I suppose that you are using Q3 2010 version.

In this case you should simply call SetToNullValue method and handle the event.
void radDateTimePicker1_KeyPress(object sender, KeyPressEventArgs e)
{
  if (e.KeyChar == 'd')
  {               this.radDateTimePicker1.DateTimePickerElement.SetToNullValue();
 e.Handled = true;
  }
}

Please refer to the attached project.

I hope this helps.

Best wishes,
Peter
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
rob mays
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
rob mays
Top achievements
Rank 1
Ed Molieri
Top achievements
Rank 1
Peter
Telerik team
Share this question
or