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

Scheduler resurces availability

4 Answers 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 05 Sep 2011, 12:52 PM
Hi All.
Could you please help me to find the best way to check availability of GroupBy resources for Scheduler. I have Employee resource (LinqDataSource) and need to cancel GroupBy parameter for scheduler if there is no emploees in the list. All I tried get an error cant change GroupBy during binding process. (or something like this)

Thanks.

4 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 07 Sep 2011, 03:57 PM
Hi Oleg,

You may try to set the GroupBy property in the Load event instead aspx file like in the code bellow:
private void Page_Load(object sender, EventArgs e)
        {
            if ("some rule")
            {
                RadScheduler1.GroupBy = "Room";
            }
        }

Hope this will help.

Greetings,
Plamen Zdravkov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Simon
Top achievements
Rank 1
answered on 08 Sep 2011, 12:28 AM
Hi Oleg,
I was tackling this one just yesterday.
In addition to what Plamen has suggested, I also had to set the GroupBy on the view settings.
I think this is because I am setting DayView-GroupBy declaratively on the scheduler tag.

* Edit - checking the appointment count does not work for me because it returns the appointment count of the scheduler from the requesting page, and not the appointment count from the resulting page!

So if it doesn't work for you right away, you might need to follow suit and put something like this in your PageLoad:

protected void Page_Load(object sender, EventArgs e)
    {
        // Supress grouping in day view if no appointments present
        if (rsScheduler.Appointments.Count == 0)
        {
            rsScheduler.DayView.GroupBy = "";          
        }
        else
        {
            rsScheduler.DayView.GroupBy = "Venue";
        }
    }
0
Oleg
Top achievements
Rank 1
answered on 08 Sep 2011, 10:32 AM
Hi All.
Thanks for your answers but this didn't bring me closer to solve my issue. Cause I cant catch the event when I can check number of rows in my Employee resource data sorce (LinqDataSource) and set GroupBy according to result.
I tried :
protected void LinqDataSource3_OnSelected(object sender, LinqDataSourceStatusEventArgs  e)
        {
            if (e.TotalRowCount > 0)
            {
                RadScheduler1.GroupBy = "Resources";
            }
            else
            {
                RadScheduler1.GroupBy = "";
            }
        }
But TotalRowCount here is -1 ... for some reason. In Simon example he counts appointments but what I need is count number of existing employees to group appointments by them. I have no problems when there are some employees in the data source, but when nothing is there scheduler displayed incorrectly.
Page_Load comes  to early, so I can do this check in there.
Any advice? Thanks, Oleg.
0
Plamen
Telerik team
answered on 13 Sep 2011, 02:37 PM
Hello Oleg,

You can refer to this KB article where is shown how the RadScheduler_DataBound can be handled.

Hope this will help.

Kind regards,
Plamen Zdravkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
Oleg
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Simon
Top achievements
Rank 1
Oleg
Top achievements
Rank 1
Share this question
or