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

[Solved] Problem using ITemplate for AdvancedInsertTemplate

1 Answer 198 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 10 Mar 2008, 06:31 PM
I am creating a custom ITemplate for the AdvancedInsertTemplate by doing the following:

RadScheduler sched = new RadScheduler();
EventForm myEventForm = new EventForm();
sched.AdvancedInsertTemplate = (ITemplate) myEventForm;

In my ITemplate I have created several TextBoxes for user input as well as a Save Button for them to save the event.

When I double-click on my Scheduler it goes to the insert template as expected, but I am unsure of how to have my custom ITemplate close and return to the scheduler when I click Cancel or Save. Do I somehow link into the event handlers already supplied with the RadScheduler and if so, how?

Thanks.

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 13 Mar 2008, 06:27 AM
Hello Andrew,

RadScheduler works through the IBindableTemplate interface in order to extract data from the templates. Your template must implement it. The interface adds just one method to ITemplate - ExtractValues. You are expected to populate and return an IOrderedDictionary instance with the template data.

The dictionary should contain the following keys:
  • Subject (string)
  • Start (DateTime)
  • End (DateTime)
  • RecurrenceRule (string, not required)
  • RecurrenceParentID (string, not required)
You can optionally add custom attribute values, in this case the attribute name becomes the dictionary key.

Resource values can also be added to the dictionary. The key should be the resource type. The value can be either a single object or an array of objects (resource key values).

A sample implementation will look like this:

public virtual IOrderedDictionary ExtractValues(Control container) 
    OrderedDictionary values = new OrderedDictionary(); 
 
    DateTime appointmentStart = ...; 
    DateTime appointmentEnd = ...; 
 
    values["Subject"] = SubjectTextBox.Text; 
    values["Start"] = appointmetStart; 
    values["End"] = appointmentEnd; 
 
    values["Room"] = 1; 
    values["CustomAttribute"] = "Value"
 
    return values; 

In order for your template to be fully functional you should include buttons (or link buttons) with CommandName value "Insert" / "Update" and "Cancel". These commands are processed by RadScheduler. Additional commands can be processed in the AppointmentCommand event.

Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Andrew
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or