Appointement template according to datasource field

6 posts, 0 answers
  1. Dédé
    Dédé avatar
    60 posts
    Member since:
    May 2009

    Posted 25 May 2009 Link to this post

    Hi,

    I would like to know if it is possible to set appointement template according to a datasource field...
    For example :

    I have a datasource selecting current day appointements, with id, start, end, subject...
    I want to add a field "type" that will be used to select rendering template. And each template will contain different controls that will show data according to "type"... Type 1 => template 1, showing appointement fields "fieldone", "fieldtwo"... Type 2 => Template 2, showing appointement fields "fieldthree"... And so on...

    Thanks
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 25 May 2009 Link to this post

    Hi Damien,

    It seems to me that the most logical solution would be to create and add templates dynamically. Here is a kb article which will guide you how to do this:
    http://www.telerik.com/support/kb/aspnet-ajax/scheduler/creating-and-adding-an-appointment-template-dynamically-and-accessing-the-appointment-object-in-the-template-class.aspx

    Feel free to contact us if you have further questions.


    Greetings,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dédé
    Dédé avatar
    60 posts
    Member since:
    May 2009

    Posted 27 May 2009 Link to this post

    Hi,

    Thanks, but I have succedded with another solution :

    I have made a custom ScheduleProvider, with custom Appointment types.
    One field is an index that will be bound to a radmultipage selectedindex property. So I have appointments rendered as I want, without writing code.

    I will take a look at your KB to see if it is better for my needs...
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 27 May 2009 Link to this post

    Hi Damien,

    That's an interesting approach. We will appreciate if you open a support ticket and send us your implementation for review. We might upload it as a code library project.


    Cheers,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Dédé
    Dédé avatar
    60 posts
    Member since:
    May 2009

    Posted 11 Jun 2009 Link to this post

    Hi,

    Here you have ASPX code for defining appointment template according to an appointment field.
    You need to define your own SchedulerProvider and Appointment classes.

    In my example, my Appointment class inherits from Telerik.Web.UI.Appointment and define a field IdAppointmentType to choose template to render :
        public class AppointmentBase:Appointment 
        { 
            public int IdAppointmentType 
            { 
                get { return this.GetValue<int>("IdAppointmentType", 0); } 
                set { this.SetValue<int>("IdAppointmentType", value); } 
            } 
     
            protected void SetValue<T>(string name, T value) 
            { 
                this.ViewState[name] = value; 
            } 
     
            protected T GetValue<T>(string name, T nullValue) 
            { 
                return (T)(this.ViewState[name] ?? nullValue); 
            } 
        } 

    My SchedulerProvider returns a collection of AppointmentBase class.
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Jun 2009 Link to this post


    Thanks.


    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017