This is a migrated thread and some comments may be shown as answers.

RadDateTimePicker using Maxdata and MinDate.

6 Answers 229 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Marcelo
Top achievements
Rank 1
Marcelo asked on 17 Sep 2010, 05:54 PM
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

6 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 21 Sep 2010, 06:41 AM
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
0
Marcelo
Top achievements
Rank 1
answered on 21 Sep 2010, 02:29 PM
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
0
Emanuel Varga
Top achievements
Rank 1
answered on 21 Sep 2010, 02:54 PM
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
0
Marcelo
Top achievements
Rank 1
answered on 21 Sep 2010, 04:01 PM
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
0
Marcelo
Top achievements
Rank 1
answered on 21 Sep 2010, 04:02 PM
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
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 22 Sep 2010, 07:13 AM
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
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Marcelo
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Marcelo
Top achievements
Rank 1
Share this question
or