RadDateTimePicker using Maxdata and MinDate.

7 posts, 1 answers
  1. Marcelo
    Marcelo avatar
    16 posts
    Member since:
    Aug 2010

    Posted 17 Sep 2010 Link to this post

    Staff,

    Put on a Maxdata RadDateTimePicker equal to the current date.
    When I navigate with the arrows up the time it hangs at Maxdata, the same does not happen when we put the MinDate.
    I would like to have the same procedure of MAXDATA.

    One more thing,
    when the states Maxdata I wish all dates greater than the MAXDATA stay with a different color to indicate the user that those dates are disabled and the same for MinDate that all dates less than the stipulated MinDate change the color too.

    Could anyone help me?

    Att,
    Marcelo Jesualdo
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 21 Sep 2010 Link to this post

    Hello Marcelo,

    Can you please tell me what version of telerik controls are you using, and if you are not using the latest version i would suggest updating to the latest version. There were a few changes and fixes in this release, including a fix for the MinDate property of the datetimepicker.

    Please try this out and please get back to me if you have any other questions.

    P.s. the dates before MinDate and the dates after MaxDate are disabled now, so they are always a different color.

    Best Regards,
    Emanuel Varga
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Marcelo
    Marcelo avatar
    16 posts
    Member since:
    Aug 2010

    Posted 21 Sep 2010 Link to this post

    Hello Emanuel,

    Thanks for helping me.

    I use version: Telerik RadControls for WinForms Q1 2009 SP1
    Publisher: Telerik Inc.
    Version: 9.1.1

    What about the problem of the color of the date, this is exactly what I wanted, when I define the MinDate or Maxdata him to swap the color in the Calendar and is not changing color.
    One more thing, regarding the date 01/01/1980 it continues aconetecendo this new version, can you tell me?

    Hug
    Marcelo Jesualdo
  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 21 Sep 2010 Link to this post

    Hello Marcello,

    The problem is that there was a problem with the minDate on the version you are using, you should update to the new version and the same thing will happen for minDate also, so this problem was fixed.

    What you are talking about with the min and max date to show the dates in a differente color shouldn't be achieved using this technique, because when you are setting the minimum / maximum date you are disabling any other date outside of that interval, that's why the buttons on the calendar have that style (disabled).

    If you would like to have that possibility you could always do the date checks internally and ignore the MinDate and MaxDate, you could just use two internal properties for max and min dates, and whenever a date change occurs, you can do the following checks inside the Value Changed Event

    It's less clearer like this in my point of view, but it will do what you want.

    private void radDateTimePicker1_ValueChanged(object sender, EventArgs e)
    {
        if (MinDate.CompareTo(radDateTimePicker1.Value) > 0 || MaxDate.CompareTo(radDateTimePicker1.Value) < 0)
        {
            radDateTimePicker1.BackColor = Color.Red;
        }
        else
        {
            radDateTimePicker1.BackColor = Color.Transparent;
        }
    }

    Please let me know if i can help you with something else,

    Best Regards,
    Emanuel Varga
  6. Marcelo
    Marcelo avatar
    16 posts
    Member since:
    Aug 2010

    Posted 21 Sep 2010 Link to this post

    Hi Emanuel,

    Here are the dates for me with the same color, not being differentiated. Would this not be a problem of the version I'm using too?
    How long must I wait for my manager to request the new version, and I've got this little problem, I would do this, change the color of the dates that are below or above the RangeMinDate and RangeMaxDate RadDateTimePicker of the calendar?

    I thank the attention they're giving me.

    Hug
    Marcelo Jesualdo
  7. Marcelo
    Marcelo avatar
    16 posts
    Member since:
    Aug 2010

    Posted 21 Sep 2010 Link to this post

    Hi Emanuel,

    Here are the dates for me with the same color, not being differentiated. Would this not be a problem of the version I'm using too?
    How long must I wait for my manager to request the new version, and I've got this little problem, I would do this, change the color of the dates that are below or above the RangeMinDate and RangeMaxDate RadDateTimePicker of the calendar?

    I thank the attention they're giving me.

    Hug
    Marcelo Jesualdo
  8. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 22 Sep 2010 Link to this post

    Hello again Marcelo,

    if you just want different color you can change my previous example, like this:
    private void radDateTimePicker1_ValueChanged(object sender, EventArgs e)
            {
                radDateTimePicker1.BackColor = Color.Transparent;
     
                // set the backcolor for values < min date
                if (MinDate.CompareTo(radDateTimePicker1.Value) > 0)
                {
                    radDateTimePicker1.BackColor = Color.Red;
                }
     
                // set the backcolor for values > max date
                if (MaxDate.CompareTo(radDateTimePicker1.Value) < 0)
                {
                    radDateTimePicker1.BackColor = Color.Green;
                }
            }
     
    I hope i understood correctly and this is what you want.

    Do not hesitate to contact me if you have any other question.
    Best Regards,
    Emanuel Varga
Back to Top
UI for WinForms is Visual Studio 2017 Ready