[SOLVED] DateTimePicker questions

Answered Closed
0
0

Hi,

  1. When the DateTimePicker calendar opens up, It seems I cannot select a date which happens to be Sunday, the column with Sundays is disabled.
  2. Can I change the day and Month names?
  3. Can I customize the “Next Month” “last Year” etc tooltips? Or disable them?
  4. Is there the possibility to allow for a null value for the control? (I know this is not the case either for Windows Forms or Visual Webgui, I had created for that purpose my own UserControl with a TextBox overlapping the DateTimePicker and a Reset button that sets the value to null and then the empty TextBox is shown, but since you are now building the framework, I thought it would be worth asking !)  🙂

Best regards,

Alex

  • You must to post comments
Best Answer
0
0

The null value support and more is already implemented:

  • The DateTimePicker control interprets blank values as DateTime.MinValue
  • You can enable the check box using ShowCheckBox = true and attach to CheckChanged (see last datetimepicker in the demo) (added: we have a bug with the CheckChanged event not being fired on the server – it works in the demo because it’s fixed but it won’t work with the currently distributed version – it’s WJ-7290)
  • When the value is empty, you can set the Watermark to show a custom text

In addition, very soon we will add the Toolbox component to all editable controls and you’ll be able to add custom icons/buttons. See the title of the window in this small demo: http://demo.wisej.com/apps/datepicker.html

Panels, windows, and soon all editables, can have any number of custom tools.

 

  • You must to post comments
0
0

Hi all,

I agree that the NullableValue is the best way to go.

regards,

Alex

  • You must to post comments
0
0

The “NullableValue” Property is a good idea and probably the best solution for the DateTime Picker.

  • You must to post comments
0
0

Add a new bindable property “NullableValue” looks like the best solution, as it doesn’t compromise the core functionality and supports the null concept. While we are talking about “bindable” properties, I’d like to see components, like MenuItem etc. to implement IBindableComponent, i.e. to be “bindable”.

  • You must to post comments
1
0

OK, thanks. But if we change DateTime to DateTime? and Decimal to Decimal? it must be done early one. It’s not something we can change after the release. Another option would be to add a new bindable property “NullableValue”.

  • You must to post comments
0
0

Hi Luca,

I have done exactly that in my custom DateTimePicker UserControl, i.e. I have it return a DateTime? value and binding works correctly. But I wouldn’t like to test an experimental build now, I think we should keep playing with one bet product at the moment and not “deviate” to different versions.

However, I don’t see why not make your controls return nullable types if this is possible. What is the opinion of other beta testers?

Best regards,

Alex

  • You must to post comments
0
0

The problem with null dates and numbers is that Microsoft left them out when they designed .NET from the start. DateTime and Decimal don’t have an IsNull property and cannot be null. In addition, ADO.NET expects and returns DBNull.Value when the db field is null.

We have a similar issue in our other .NET framework and we added IsNull and UseMinValueAsNull and we have an IDbValue interface for binding on our custom types. However those solutions cannot be applied to Wisej.

We could change the Value type of DateTimePicker and NumericUpDown to DateTime? and Decimal? nullable types. That would allow the control to return null when empty. I’m not sure how a database bound data source would react, need to test this.

Would you like to receive an experimental build with DateTime? and Decimal? Value properties in DateTimePicker and NumericUpDown and give it a try on your end?

  • You must to post comments
0
0

Hi,

  1. Forget what I said for Sundays, I was obviously blinded ! I was clicking on the left column, obviously the week counter! Sorry for the false alarm.
  2. If I understand correctly, if DateTimePicker interprets empty value as DateTime.MinValue, this means, I suppose, that when the control is bound to a datasource, it will propagate this DateTime.MinValue to the database. Instead, I would like to send Null to the database. May be other people can express their opinions too.

Thanks for your answers.

Best regards,

Alex

  • You must to post comments
0
0

To answer the other questions:

  • I can’t reproduce the disable Sunday. Can you give me more info or a small test case?
  • Currently the month names are localized in a bad way using the server’s locale, which is wrong. It should use the browser’s/client-setting language and should be customizable. It’s bug WJ-7291. However, the month names can be changed for the application (user session) and not for the single datetimepicker control.
  • Will add the option to disable and localize the date picker tooltips. It’s WJ-7230.

Thanks!

Best,

Luca

  • Frank (ITG)
    Option to disable / localize date picker tooltips is WJ-7292
  • You must to post comments
0
0

Also a +1 from our site for this feature! We implemented a similar custom user control in VWG for this feature. Basically it was a DateTimePicker with a checkbox, through which the selected value could be cleared and set to null.

  • You must to post comments
0
0

+1 for a nullable date picker – the number of times (and the number of frameworks) where I’ve had to implement this!

  • You must to post comments
Showing 11 results