Skip to content

DateTimePicker questions #61

Closed
Closed

Description

@itg-assistant

Alex Prinias asked 2016-05-24 21:52:00 UTC

Hi,

  • When the DateTimePicker calendar opens up, It seems I cannot select a date which happens to be Sunday, the column with Sundays is disabled.

  • Can I change the day and Month names?

  • Can I customize the "Next Month" "last Year" etc tooltips? Or disable them?

  • 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

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Nic Adams answered 2016-05-25 09:59:00 UTC

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

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Markus answered 2016-05-25 10:10:00 UTC

    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.

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-05-25 14:52:19 UTC

    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.

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-05-25 15:00:23 UTC

    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

  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-05-25 16:35:00 UTC

    Hi,

    • 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.

    • 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

  6. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-05-25 17:25:47 UTC

    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?

  7. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-05-25 18:05:00 UTC

    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

  8. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-05-25 18:34:06 UTC

    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".

  9. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Tiago Freitas Leal answered 2016-05-25 23:20:00 UTC

    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".

  10. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Washington Jordan answered 2016-05-26 01:46:22 UTC

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

  11. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Alex Prinias answered 2016-05-26 09:47:52 UTC

    Hi all,

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

    regards,

    Alex

  12. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2016-06-20 22:39:45 UTC

    Option to disable / localize date picker tooltips is WJ-7292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions