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

Appointement template according to datasource field

5 Answers 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dédé
Top achievements
Rank 1
Dédé asked on 25 May 2009, 10:24 AM
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

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 25 May 2009, 03:27 PM
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.
0
Dédé
Top achievements
Rank 1
answered on 27 May 2009, 02:42 PM
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...
0
Peter
Telerik team
answered on 27 May 2009, 03:19 PM
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.
0
Dédé
Top achievements
Rank 1
answered on 11 Jun 2009, 03:12 PM
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.
0
Peter
Telerik team
answered on 11 Jun 2009, 03:23 PM

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.
Tags
Scheduler
Asked by
Dédé
Top achievements
Rank 1
Answers by
Peter
Telerik team
Dédé
Top achievements
Rank 1
Share this question
or