Scheduler resurces availability

5 posts, 0 answers
  1. Oleg
    Oleg avatar
    7 posts
    Member since:
    Mar 2009

    Posted 05 Sep 2011 Link to this post

    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.
  2. Plamen
    Admin
    Plamen avatar
    2933 posts

    Posted 07 Sep 2011 Link to this post

    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 >>

  3. Simon
    Simon avatar
    26 posts
    Member since:
    Jul 2011

    Posted 07 Sep 2011 Link to this post

    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";
            }
        }
  4. Oleg
    Oleg avatar
    7 posts
    Member since:
    Mar 2009

    Posted 08 Sep 2011 Link to this post

    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.
  5. Plamen
    Admin
    Plamen avatar
    2933 posts

    Posted 13 Sep 2011 Link to this post

    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.
Back to Top