We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Null data in DateTimePicker

Thread ID:





124987 Jul 13,2016 03:59 AM UTC Jul 19,2016 03:58 PM UTC WinForms 8
Tags: GridGroupingControl
Asked On July 13, 2016 03:59 AM UTC

I have seen some threads concerning the allowance of null data into a foreseen DateTimePickerEx, is there anything new on this? - Nicolas

Venkateshwaran Ramdoss [Syncfusion]
Replied On July 14, 2016 08:46 AM UTC

Hi Nicolas,

Thank you for contacting Syncfusion Support.

It is possible to apply Null value to the DateTimePickedAdv by using the options below.

Option 1: By enabling IsNullDate property and also set the NullString value as empty in the DateTimePickerAdv. Refer to the below KB link.

KB link: https://www.syncfusion.com/kb/2724/how-to-set-null-value-to-datetimepickeradv  

Option  2: By creating a Custom control derived from DateTimePickerAdv and implement a property that helps to hold the Nullable value. You can refer to the below KB article.

KB link: https://www.syncfusion.com/kb/6743/how-to-assign-nullable-value-in-datetimepickeradv  

Please confirm whether the given solution works for you. Or else share us more details of the thread/forum which you had mentioned in the last update. It would be helpful to provide a prompt solution.

Venkateshwaran V.R.

Replied On July 15, 2016 03:24 AM UTC

Hi Venkateshweran, thank you for sharing this ! After implementing, the first option, it works as expected by getting or setting null values. I noticed however that this UI has sometimes a funky reaction, it might be worthwhile to take a look. Sometimes, I try to set a value and when I navigate to other controls (standard WIN textbox & combo), then I notice that either the value is not kept or it resets by itself to a null value. 

Meanwhile, I havent tried your 2nd option, but came up with a 3rd option, by the use of ComboDropDown on which I assign a MonthCalendarAdv (https://www.syncfusion.com/kb/1333/is-there-a-way-to-configure-datetimepickeradv-so-that-date-entry-is-consistent-with-the-grid-cell)

DateTImePicker1.PopupControl = MonthCalendarAdv1

DateTmePIcker1.PopupControl.Height = 150

DateTimePicker1.PopupControl.Height = 150

I like the look & feel for this 3rd option, however on this, it seems I cannot pickup the date value, and the width of the calendar seems to be dependent of the control, even if I assign it as shown previously

Replied On July 15, 2016 03:28 AM UTC

Sorry you should read the code as follows:

ComboDropDown1.PopupControl = MonthCalendarAdv1

ComboDropDown1.PopupControl.Height = 150

ComboDropDown1.PopupControl.Height = 150

Thank you! - Nicolas

Venkateshwaran Ramdoss [Syncfusion]
Replied On July 18, 2016 11:50 AM UTC

Hi Nicolas, 

Thank you for your update. 

Query 1:"PopUpControl.Height?" 

The PopUpControl Height will be specified based on control height. 

Query 2:"PopUpControl.Width?" 

We can set the PopUpControl Width by using "DropDownWidth" property. We have prepared a sample with the same and it can be downloaded from the below link. 

Code snippet: 
this.comboDropDown1.DropDownWidth = 213; 

Venkateshwaran V.R. 

Replied On July 18, 2016 09:59 PM UTC

Great! Thank you! Works like a charm - Nicolas

Replied On July 18, 2016 10:45 PM UTC

Hi Venkateshwaran, I have a sub-question for you : Now everything is fine, but thinking of perfecting the flow: when using the datetimepicker in the GGC, I use the GridGroupingControl1_QueryCellStyleInfo to update my form and the DateTimepickerAdv, but as you know this event is rather CPU consuming, so I tried to pass my functions through GridGroupingControl1_CurrentRecordContextChange, where it picks up the e.Action = CurrentRecordAction.BeginEdit (both), but it seems to be skipping the e.Action = CurrentRecordAction.EndEdit, is this normal? Thanks in advance - Nicolas

Replied On July 19, 2016 09:41 AM UTC

Got it finally! the GridGroupingControl1_TableControlCurrentCellEditingComplete is much more efficient and does perfectly the job - Thanks again! - Nicolas

Anish George [Syncfusion]
Replied On July 19, 2016 03:58 PM UTC

Hi Nicolas, 
We are glad to hear the issue has been resolved in your end. Please let us know if you need any further assistance. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon