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.
Unfortunately, activation email could not send to your email. Please try again.

Null data in DateTimePicker

Thread ID:

Created:

Updated:

Platform:

Replies:

124987 Jul 12,2016 11:59 PM Jul 19,2016 11:58 AM Windows Forms 8
loading
Tags: GridGroupingControl
Nicolas
Asked On July 12, 2016 11:59 PM

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 04:46 AM

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.

Regards,
Venkateshwaran V.R.


Nicolas
Replied On July 14, 2016 11:24 PM

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


Nicolas
Replied On July 14, 2016 11:28 PM

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 07:50 AM

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; 
 

Regards, 
Venkateshwaran V.R. 


Nicolas
Replied On July 18, 2016 05:59 PM

Great! Thank you! Works like a charm - Nicolas

Nicolas
Replied On July 18, 2016 06:45 PM

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

Nicolas
Replied On July 19, 2016 05:41 AM

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 11:58 AM

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. 
  
Regards, 
Anish 


CONFIRMATION

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.

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.

;