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

Automatic resizing

3 Answers 94 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Regula
Top achievements
Rank 1
Regula asked on 09 Sep 2011, 02:51 PM
I there.

I've a timetable in a WeekDay view. Depending on the information got from the datasource, sometimes I have more than 10 concurrent appointments for and sometimes I have only 1 or 3 appointments at the same time. In the case where I have 10 appointments I have to increase the radscheduler width but in cases I have only 1 or 3 appointments I don't want to change the width.

I don't if it is possible, but I want to in someway to resize automatically the radscheduler based in the number of appointments at the same time. 
For instance, in a weekview, if the maximum number of concurrent appointments is 2 then I would like to set the radsched width to 500px, if I have 5 concurrent appointments I would like set to 800px and if I have 10 concurrent appointments I'de like to set width to 1000px.

Is that possible? There is another approach for this problem?


Thanks




3 Answers, 1 is accepted

Sort by
0
Accepted
Ivana
Telerik team
answered on 13 Sep 2011, 05:02 PM
Hi Regula,

The following code in code-behind shows how to set the ColumnWidth of the RadScheduler automatically.
CS:
private int maxAppCount = 0;
    protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
    {
        if (e.TimeSlot.Appointments.Count > maxAppCount)
        {
            maxAppCount = e.TimeSlot.Appointments.Count;
        }
    }
     
    protected void RadScheduler1_DataBound(object sender, EventArgs e)
    {
        int maxCount = 0;
        foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(RadScheduler1.VisibleRangeStart, RadScheduler1.VisibleRangeEnd))
        {
            if(appMaxCount(a) > maxCount)
            {
                maxCount = appMaxCount(a);
            }
        }
        RadScheduler1.ColumnWidth = Unit.Pixel(maxCount*100);
    }
 
    protected int appMaxCount(Appointment apt)
    {
        int appointmentsCount = 0;
        foreach (Appointment existingApt in RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.End))
        {
            if (existingApt.Visible)
                appointmentsCount++;
        }
        return (appointmentsCount);
    }


Hope this helps.

Kind regards,
Ivana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Regula
Top achievements
Rank 1
answered on 13 Sep 2011, 05:22 PM
Thanks Ivana.

There is anyway to change one specific collumn, ie, if I dectect that Thursday has 10 overlaping Appointments, can I increase Thursday collumn only, lefting all other collumns with the same value?

Thanks
0
Accepted
Ivana
Telerik team
answered on 14 Sep 2011, 04:34 PM
Hello Regula,

The RadScheduler control in its current form does not support changing of specific column's width.

All the best,
Ivana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
Scheduler
Asked by
Regula
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Regula
Top achievements
Rank 1
Share this question
or