How do I get the first date shown and the last date shown

4 posts, 0 answers
  1. LCJ
    LCJ avatar
    14 posts
    Member since:
    Nov 2007

    Posted 05 Feb 2009 Link to this post

    I cannot seem to get the first date shown and the last date shown.  There are two property with the term "display" (sorry, do not have VS open to tell you the exact properties) and that specify start and end dates.  I want to query the database and pull all values between these two dates so that I can color the cells accordingly (light for fewer things, dark for more things, any direction on this would be welcome also but I haven't looked at it yet).

    For some reason I don't seem to be able to get any values back from these properties.  Are these the right properties?
  2. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 06 Feb 2009 Link to this post

    Hey LJC,

    I was curious so I had to check this out, and you're definitely right that these come up as nulls.  One thing I noticed though is that when you try to set the date, looking at the items in debug mode the DisplayStartDate/DisplayEndDate will show the correct value, but this gets thrown to prevent further operation:

    Invalid DisplayDateStart value.
    Parameter name: sender

    So I am guessing there is an incorrect reference somewhere?  Hopefully this can be remedied for Q1, the Telerik calendar is so much nicer to look at than the default MS one. :)

    P.S., I checked and this does work on the RadDatePicker, just not on Calendar.  Also, DisplayDateEnd works fine, but DisplayDateStart is the one with the problem on both.
  3. DevCraft banner
  4. Jyoti
    Jyoti avatar
    1 posts
    Member since:
    Jun 2011

    Posted 18 Jul 2011 Link to this post

    Is Displaystartdate is working fine in Raddatepicker? I am getting an error if i want to set the value dynamically. Displayenddate is working fine.
  5. Pana
    Admin
    Pana avatar
    748 posts

    Posted 22 Jul 2011 Link to this post

    Hello Jyoti,

    Problem is RadCalendar does not coerce its DisplayDateStart, DisplayDate, DisplayDateEnd properly. For example the following code fails:

    calendar.DisplayDate = DateTime.Today.Date.AddDays(3);
    calendar.DisplayDateStart = DateTime.Today.Date.AddDays(4);
    calendar.DisplayDateEnd = DateTime.Today.Date.AddDays(20);

    while the following works:

    calendar.DisplayDate = DateTime.Today.Date.AddDays(3);
    calendar.DisplayDateStart = DateTime.Today.Date.AddDays(2);
    calendar.DisplayDateEnd = DateTime.Today.Date.AddDays(20);

    You could take for granted the default DisplayDateStart is smallest possible DateTime in the calendar, while the DisplayDateEnd is the last. Setting the DisplayDateStart to a day bigger than the DisplayDate will throw an exception. So as a workaround you could first set the DisplayDate to the value you desire and after set the DisplayDateStart and DisplayDateEnd.

    If you are about to change these values more than once you could try to first clear the old Start and End values by setting the Start to a really small date and the End to really large (like the years 0001 and 3000), set the DisplayDate and then set the DisplayStartDate and DisplayEndDate to the real values.

    I know this workaround is ugly but you could use it until we fix the value coercing.

    Greetings,
    Pana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top