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

Show Now + 2 Weeks

2 Answers 60 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Shane Clay
Top achievements
Rank 1
Shane Clay asked on 31 May 2015, 04:09 AM

Hi All

Not sure this is possible, can't find any examples, so thought I'd ask.

We want to create a calendar, preferably using the RadCalendar, that shows the first day of the current week + 14 days. Ie, rather than showing the entire current month, just show this week and next week.

We'll then use the Day Render event to show relevant information in that cell for that day. 

Has anyone seen something like this done with RadCalendar?

Shane

2 Answers, 1 is accepted

Sort by
0
Shane Clay
Top achievements
Rank 1
answered on 31 May 2015, 04:13 AM

Using RangeMinDate and RangeMaxDate with ShowOtherMonthsDays="false" gets us part of the way there.

Ideally though, we wouldn't see the rest of the days rendered at all, not even as blank cells. 

0
Konstantin Dikov
Telerik team
answered on 03 Jun 2015, 01:43 PM
Hi Shane,

You can handle the server-side OnDayRender event of RadCalendar and set the Visible property of the cells that you want to hide to "false", but please note that this will break the structure of the calendar and the days will not be aligned correctly:
protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
    if (e.Day.Date < RadCalendar1.RangeMinDate || e.Day.Date > RadCalendar1.RangeMaxDate)
    {
        //e.Cell.Visible = false;          
    }
}

Now, if you need to hide the out of range cells, you can use the following CSS:
<style type="text/css">
    .rcOutOfRange span{
        display: none!important;
    }
</style>

And here is the RadCalendar markup:
<telerik:RadCalendar ID="RadCalendar1" runat="server" RangeMinDate="6/3/2015" RangeMaxDate="6/15/2015" ShowOtherMonthsDays="false" OnDayRender="RadCalendar1_DayRender"></telerik:RadCalendar>

Hope this helps.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Shane Clay
Top achievements
Rank 1
Answers by
Shane Clay
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or