5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 19 Jul 2013, 12:33 PM
Hi Needha,
Try setting the DisplayDateFormat to "dd/MM/yyyy" as shown below.
ASPX:
Thanks,
Shinu.
Try setting the DisplayDateFormat to "dd/MM/yyyy" as shown below.
ASPX:
<
telerik:RadDatePicker
ID
=
"RadDatePicker1"
runat
=
"server"
>
<
DateInput
DisplayDateFormat
=
"dd/MM/yyyy"
>
</
DateInput
>
</
telerik:RadDatePicker
>
Thanks,
Shinu.
0
Needha
Top achievements
Rank 1
answered on 23 Jul 2013, 08:27 AM
It works. Shinu I have another one requirement. I want to give red color to all sundays in the calendar of a datepicker and user should not be able to select those.
0
Shinu
Top achievements
Rank 2
answered on 23 Jul 2013, 10:38 AM
Hi Needha,
Please have a look into the following code I tried which works fine at my end.
ASPX:
C#:
Thanks,
Shinu.
Please have a look into the following code I tried which works fine at my end.
ASPX:
<
telerik:RadDatePicker
ID
=
"RadDatePicker1"
runat
=
"server"
>
<
Calendar
runat
=
"server"
OnDayRender
=
"RadCalendar1_DayRender"
>
</
Calendar
>
</
telerik:RadDatePicker
>
C#:
protected
void
RadCalendar1_DayRender(
object
sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
if
(e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
{
// clear the default cell content (anchor tag) as we need to disable the css effect for this cell
e.Cell.Text =
""
;
//adding a new label as the calendar day in order to apply the required styles
Label label =
new
Label();
label.Text = e.Day.Date.Day.ToString();
label.ForeColor = System.Drawing.Color.Red;
e.Cell.Controls.Add(label);
RadCalendarDay calendarDay =
new
RadCalendarDay();
calendarDay.Date = e.Day.Date;
calendarDay.IsSelectable =
false
;
//disable date selection
RadDatePicker1.Calendar.SpecialDays.Add(calendarDay);
}
}
Thanks,
Shinu.
0
Needha
Top achievements
Rank 1
answered on 23 Jul 2013, 05:45 PM
Hi shinu
I think I didnt mention my requirement clearly. I need to set red color to the background and not as the fore color.
I think I didnt mention my requirement clearly. I need to set red color to the background and not as the fore color.
0
Shinu
Top achievements
Rank 2
answered on 24 Jul 2013, 04:44 AM
Hi Needha,
You can try the following C# code instead of the one I wrote to set the label fore color.
C#:
Thanks,
Shinu.
You can try the following C# code instead of the one I wrote to set the label fore color.
C#:
label.BackColor = System.Drawing.Color.Red;
Thanks,
Shinu.