Refresh ScheduleView after adding resources in code behind

6 posts, 0 answers
  1. Jeffrey
    Jeffrey avatar
    5 posts
    Member since:
    Sep 2012

    Posted 17 May 2011 Link to this post


    I'm evaluating this control to look if it fills my needs, because I'm building an application where I need a schedule component.

    In code behind i'm adding resources to a ResourceType in my ResourceTypeCollection, but the new resource is not displayed in the ScheduleView. When I navigate to another day then the new Resource appears.

       ResourceType.Resources.Add(new Resource { ResourceName = "Phil Collins" });

    Now I tried the following and this works, but I can't imagine that this is a proper way to make it work.

       ResourceType.Resources.Add(new Resource { ResourceName = "Phil Collins" });
    ResourceTypeCollection is an ObservableCollection<ResourceType>() and when I Add or Remove a Resource the ScheduleView is updated, but isn't there a way to update the ScheduleView when I just add Resources without removing / adding ResourceTypes from / to the ResourceTypeCollection?

    Thanks in advance!

    Best regards,
  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 20 May 2011 Link to this post

    Hi Jeffrey,

    You are correct, this is the right way to add resources to a resource type at runtime. We intentionally do not listen for changes in the Resources collection of a ResourceType (actually all of its properties) because of performance considerations, as we will have to reset the whole RadScheduleView once a Resource is added, and if you are adding many resources, we will have to do a reset every time.

    Best wishes,
    Valeri Hristov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Dan
    Dan avatar
    5 posts
    Member since:
    Sep 2008

    Posted 29 Jun 2012 Link to this post

    This solution does not cause the ScheduleView to refresh the resources.  i'm using a usercontrol to style the resource headers and they are not refreshing when the ResourceTypeCollection is set or when an item in the collection is changed. my solution involves creating a new instance of the control, but this is not an option in all instances.
  5. Yana
    Yana avatar
    4548 posts

    Posted 04 Jul 2012 Link to this post


    We've prepared a help topic which explains in more details how you can update the resources at runtime. You can check it at the following link:

    If you still have any issues, please contact us again.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 26 Feb 2013 Link to this post


    Regarding performance, what is the best method to use of the two described in the link abowe?

    I use the remove/add of the resource type but it is taking a couple of seconds for me, when I have 200+ resources with 600+ appointments.
    Would I gain anything by implementing the group filter instead?

  7. Yana
    Yana avatar
    4548 posts

    Posted 01 Mar 2013 Link to this post

    Hi Håkan,

    I guess that implementing Group Filter should be faster, but it depends on the specific case as well.  I have attached a sample project with 200 resources and group filter, so you could check whether this solution is suitable for your case.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner