Resource grouping with object datasources

2 posts, 0 answers
  1. David Penny
    David Penny avatar
    174 posts
    Member since:
    Jun 2006

    Posted 20 Oct 2009 Link to this post


    I'm not sure why but I just don't seem to be getting grouping by Resource.

    I want to have a Scheduler show Staff down the left hand side, time horizontally, and based on the examples this looks like grouping by Staff, but all the examples seem to use either a direct connection or session datasources.

    I am populating my Scheduler by assigning a datasource in code (RadScheduler1.datasource = myDataSource) and all OK.

    Do you have any help or examples that might show me how to do the same with my Resources as well, and then how to Group these, all within code rather than declaratively?

    David Penny
  2. Peter
    Peter avatar
    6637 posts

    Posted 27 Oct 2009 Link to this post

    Hi David,

    Please, refer to the Binding to generic list demo. In this demo the resources are defined manually like this:
    private void InitializeResources()
                ResourceType resType = new ResourceType("User");
                resType.ForeignKeyField = "UserID";
                RadScheduler1.Resources.Add(new Resource("User", 1, "Alex"));
                RadScheduler1.Resources.Add(new Resource("User", 2, "Bob"));
                RadScheduler1.Resources.Add(new Resource("User", 3, "Charlie"));

    Then, they are added in OnInit:
    protected override void OnInit(EventArgs e)
                if (!IsPostBack)
                RadScheduler1.DataSource = Appointments;

    However, you can set DataSource or DataSourceId for your Resource type. Here are the properties which you need to set:
    * * *
    <telerik:ResourceType KeyField="ID" Name="Room" TextField="RoomName" ForeignKeyField="RoomID" DataSourceID="RoomsDataSource" />
    * * *
    These properties can be set in code behind as well.

    The important thing is that you use OnInit to add the resources.

    Feel free to contact us if you have any other questions.

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top