Calendar Control Won't Show Selected Date if Value Has Time Value != Midnight

Discussion in 'ASP .Net' started by Mark Olbert, Mar 7, 2007.

  1. Mark Olbert

    Mark Olbert Guest

    I just noticed something weird about the calendar control in ASPNET2. If you assign a value to SelectedDate that has a time
    component (e.g., 3/1/2007 10:37 AM), and you have a custom style for the selected day, the selected day will not be rendered using
    the custom style. Instead, the control acts like >>no<< date has been selected.

    I came across this when doing a SelectedDate='<%# Bind("date_field") %>', where the date_field is a datetime sql server field.
    There's an obvious workaround -- use ((DateTime) Eval("date_field")).Date instead of the Bind expression -- but then you have to add
    code to extract the value before, say, doing an update against the database, since you've lost the databinding (and Bind() does not
    return a value; it binds values).

    Of course, an even better workaround would be for the silly control to work right in the first place, and recognize that a
    SelectedDate of 3/1/2007 10:37 AM is, in the context of a >>calendar<< equivalent to 3/1/2007 12:00 AM and should be treated as such
    for purposes of deciding when to render using the SelectedDay style.

    - Mark
    Mark Olbert, Mar 7, 2007
    #1
    1. Advertising

  2. Hello Mark,

    Regarding on the Calendar control SelectedDateStyle issue, I have checked
    our internal database and this is an existing bug that has been already
    reported. The problem is occuring when the selectedData be assigned a non
    zero-end datetime instance. You can also found the bug entry in the public
    feedback center:

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
    kID=105127

    So far I think the workaround you mentioned should be the reasonable way.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Mar 7, 2007
    #2
    1. Advertising

  3. Mark Olbert

    Mark Olbert Guest

    Steven,

    Thanks for the link.

    But I'm confused: the bug was confirmed over a year ago, and it's still not fixed? At last count I think I've downloaded, oh,
    something over 200 patches from Microsoft for various Windows- and Office-related bugs in that time. What keeps the ASP.NET
    Framework team from getting these kinds of fixes out sooner?

    - Mark

    On Wed, 07 Mar 2007 12:40:04 GMT, (Steven Cheng[MSFT]) wrote:

    >Hello Mark,
    >
    >Regarding on the Calendar control SelectedDateStyle issue, I have checked
    >our internal database and this is an existing bug that has been already
    >reported. The problem is occuring when the selectedData be assigned a non
    >zero-end datetime instance. You can also found the bug entry in the public
    >feedback center:
    >
    >http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105127
    >
    >So far I think the workaround you mentioned should be the reasonable way.
    >
    >Sincerely,
    >
    >Steven Cheng
    >
    >Microsoft MSDN Online Support Lead
    >
    >
    >
    >==================================================
    >
    >Get notification to my posts through email? Please refer to
    >http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    >ications.
    >
    >
    >
    >Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    >where an initial response from the community or a Microsoft Support
    >Engineer within 1 business day is acceptable. Please note that each follow
    >up response may take approximately 2 business days as the support
    >professional working with you may need further investigation to reach the
    >most efficient resolution. The offering is not appropriate for situations
    >that require urgent, real-time or phone-based interactions or complex
    >project analysis and dump analysis issues. Issues of this nature are best
    >handled working with a dedicated Microsoft Support Engineer by contacting
    >Microsoft Customer Support Services (CSS) at
    >http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    >==================================================
    >
    >
    >
    >This posting is provided "AS IS" with no warranties, and confers no rights.
    Mark Olbert, Mar 7, 2007
    #3
  4. Thanks for your reply Mark,

    As for the windows update(or update of some other end user products like
    office), they are different from the fixed for .net framework or visual
    studio. For windows or office, we can frequently publish new update or
    packs and the end user can choose to install them at their convenient time.
    And different user may have different updated version on their machine.
    However, for .net framework or visual studio, we can not publish such fix
    or service pack frequently, because .net framework/visual studio is tools
    and base component that used to build applications, frequent change on this
    will result to inconsistency between developers that has installed
    different updates or packs. Therefore, Visual Studio or .net framework
    will only publish a large service pack after a long time(based on the
    common fixed that has ever been collected). For individual users, if
    necessary, CSS can help create on-demand hotfix, generally, this will be
    userful if a certain server application require such as rapid fix.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Mar 9, 2007
    #4
  5. Mark Olbert

    Mark Olbert Guest

    Steven,

    I thought one of the benefits of managed code was to be able to run apps using different versions of the same library side-by-side
    without any conflicts. In other words, no more DLL hell.

    If that's so, why couldn't there be multiple versions of the same Framework libraries being used throughout the world? Granted, some
    extra storage would be consumed, but that's pretty cheap these days.

    - Mark
    Mark Olbert, Mar 10, 2007
    #5
  6. Thanks for your reply Mark,

    Yes, .net framework make managed application and assembly easy to deploy
    side by side or redirect version to version. However, this is for
    individual applications and their custom assemblies. For system/framework
    class library, they're always tightly coupled with the CLR runtime version.
    That means when the process start CLR runtime, it will always load a fixed
    version framework library(lots of system fundatmential assemblies such as
    Mscorlib.dll, System.dll....). These assemblies can not be redirected to
    different version individually, you could only redirect the entire
    framework library's version(the runtime will load a different version of
    NET CLR and framework libraries). So far this CLR loading mechanism still
    limit the framework's versioning support, and it is not quite good to
    change the framework base class library frequently.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Mar 13, 2007
    #6
  7. Re:

    It's 2010 now and bug still presents!!



    stchen wrote:

    Thanks for your reply Mark,Yes, .
    12-Mar-07

    Thanks for your reply Mark

    Yes, .net framework make managed application and assembly easy to deploy
    side by side or redirect version to version. However, this is for
    individual applications and their custom assemblies. For system/framework
    class library, they're always tightly coupled with the CLR runtime version.
    That means when the process start CLR runtime, it will always load a fixed
    version framework library(lots of system fundatmential assemblies such as
    Mscorlib.dll, System.dll....). These assemblies can not be redirected to
    different version individually, you could only redirect the entire
    framework library's version(the runtime will load a different version of
    NET CLR and framework libraries). So far this CLR loading mechanism still
    limit the framework's versioning support, and it is not quite good to
    change the framework base class library frequently

    Sincerely

    Steven Chen

    Microsoft MSDN Online Support Lea

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Previous Posts In This Thread:

    On Wednesday, March 07, 2007 1:02 AM
    Mark Olbert wrote:

    Calendar Control Won't Show Selected Date if Value Has Time Value != Midnight
    I just noticed something weird about the calendar control in ASPNET2. If you assign a value to SelectedDate that has a tim
    component (e.g., 3/1/2007 10:37 AM), and you have a custom style for the selected day, the selected day will not be rendered usin
    the custom style. Instead, the control acts like >>no<< date has been selected

    I came across this when doing a SelectedDate='<%# Bind("date_field") %>', where the date_field is a datetime sql server field
    There's an obvious workaround -- use ((DateTime) Eval("date_field")).Date instead of the Bind expression -- but then you have to ad
    code to extract the value before, say, doing an update against the database, since you've lost the databinding (and Bind() does no
    return a value; it binds values)

    Of course, an even better workaround would be for the silly control to work right in the first place, and recognize that
    SelectedDate of 3/1/2007 10:37 AM is, in the context of a >>calendar<< equivalent to 3/1/2007 12:00 AM and should be treated as suc
    for purposes of deciding when to render using the SelectedDay style

    - Mark

    On Wednesday, March 07, 2007 7:40 AM
    stchen wrote:

    Hello Mark,Regarding on the Calendar control SelectedDateStyle issue, I have
    Hello Mark

    Regarding on the Calendar control SelectedDateStyle issue, I have checked
    our internal database and this is an existing bug that has been already
    reported. The problem is occuring when the selectedData be assigned a non
    zero-end datetime instance. You can also found the bug entry in the public
    feedback center

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedba
    kID=10512

    So far I think the workaround you mentioned should be the reasonable way

    Sincerely

    Steven Chen

    Microsoft MSDN Online Support Lea



    =================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti
    ications



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx

    =================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.

    On Wednesday, March 07, 2007 10:06 AM
    Mark Olbert wrote:

    Steven,Thanks for the link.
    Steven,

    Thanks for the link.

    But I'm confused: the bug was confirmed over a year ago, and it's still not fixed? At last count I think I've downloaded, oh,
    something over 200 patches from Microsoft for various Windows- and Office-related bugs in that time. What keeps the ASP.NET
    Framework team from getting these kinds of fixes out sooner?

    - Mark

    On Wed, 07 Mar 2007 12:40:04 GMT, (Steven Cheng[MSFT]) wrote:

    On Thursday, March 08, 2007 10:46 PM
    stchen wrote:

    Thanks for your reply Mark,As for the windows update(or update of some other
    Thanks for your reply Mark,

    As for the windows update(or update of some other end user products like
    office), they are different from the fixed for .net framework or visual
    studio. For windows or office, we can frequently publish new update or
    packs and the end user can choose to install them at their convenient time.
    And different user may have different updated version on their machine.
    However, for .net framework or visual studio, we can not publish such fix
    or service pack frequently, because .net framework/visual studio is tools
    and base component that used to build applications, frequent change on this
    will result to inconsistency between developers that has installed
    different updates or packs. Therefore, Visual Studio or .net framework
    will only publish a large service pack after a long time(based on the
    common fixed that has ever been collected). For individual users, if
    necessary, CSS can help create on-demand hotfix, generally, this will be
    userful if a certain server application require such as rapid fix.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.

    On Saturday, March 10, 2007 12:35 PM
    Mark Olbert wrote:

    Steven,I thought one of the benefits of managed code was to be able to run
    Steven,

    I thought one of the benefits of managed code was to be able to run apps using different versions of the same library side-by-side
    without any conflicts. In other words, no more DLL hell.

    If that's so, why couldn't there be multiple versions of the same Framework libraries being used throughout the world? Granted, some
    extra storage would be consumed, but that's pretty cheap these days.

    - Mark

    On Monday, March 12, 2007 11:34 PM
    stchen wrote:

    Thanks for your reply Mark,Yes, .
    Thanks for your reply Mark,

    Yes, .net framework make managed application and assembly easy to deploy
    side by side or redirect version to version. However, this is for
    individual applications and their custom assemblies. For system/framework
    class library, they're always tightly coupled with the CLR runtime version.
    That means when the process start CLR runtime, it will always load a fixed
    version framework library(lots of system fundatmential assemblies such as
    Mscorlib.dll, System.dll....). These assemblies can not be redirected to
    different version individually, you could only redirect the entire
    framework library's version(the runtime will load a different version of
    NET CLR and framework libraries). So far this CLR loading mechanism still
    limit the framework's versioning support, and it is not quite good to
    change the framework base class library frequently.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.


    Submitted via EggHeadCafe - Software Developer Portal of Choice
    Fast KeyWord String searching Algorithms
    http://www.eggheadcafe.com/tutorial...3-4decf97d75ce/fast-keyword-string-searc.aspx
    Alexnader M. Batishchev, Jan 20, 2010
    #7
  8. Mark Olbert

    Patrice Guest

    Re: Re:

    > I just noticed something weird about the calendar control in ASPNET2. If
    > you assign a value to SelectedDate that has a time
    > component (e.g., 3/1/2007 10:37 AM), and you have a custom style for the
    > selected day, the selected day will not be rendered using
    > the custom style. Instead, the control acts like >>no<< date has been
    > selected.


    > It's 2010 now and bug still presents!!


    And the style is defined using ? A problem seems to be that the default
    inline styles are taking precedence over the CSS class. Otherwise it seems
    to work.

    I'm sometimes using skin files just to define the overall appearence when
    the generated HTML prevents to use CSS...

    --
    Patrice
    Patrice, Jan 20, 2010
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael England
    Replies:
    0
    Views:
    598
    Michael England
    Nov 26, 2003
  2. =?Utf-8?B?UGV0ZXI=?=

    ASP.NET Calendar control's selected date

    =?Utf-8?B?UGV0ZXI=?=, Apr 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,466
    Philip Q [MVP]
    Apr 23, 2004
  3. KatB
    Replies:
    1
    Views:
    676
    Ken Cox [Microsoft MVP]
    Feb 2, 2005
  4. Ethan Furman

    datetime.time and midnight

    Ethan Furman, Feb 21, 2009, in forum: Python
    Replies:
    6
    Views:
    1,039
    Ethan Furman
    Feb 22, 2009
  5. Replies:
    3
    Views:
    170
    Dr J R Stockton
    May 21, 2007
Loading...

Share This Page