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

[Solved] Load Advance Form Dynamically

3 Answers 202 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nick S
Top achievements
Rank 1
Nick S asked on 13 Nov 2009, 02:19 AM
Hello,
   I need to wrap RadScheduler into a custom control.  We need to customize the Advanced Edit form.  How can I implement AdvancedEditTemplate and add ASCX advanced form dynamically?  Does anyone have an example how to do that?
Thanks in advance,
Nick

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Nov 2009, 07:50 AM
Hi Nick,

I hope the documentation and demo will be of helpful in customizing the Advanced Form Template.

Regards,
Shinu.
0
Nick S
Top achievements
Rank 1
answered on 13 Nov 2009, 07:36 PM
Thanks Shinu for the reply.  I got to the point that I could bring up the advance form.  But I kept getting "windows.SchedulerAdvancedTemplate is not a constructor" javascript error when it loaded the Advanced form. 
It threw an error on the line: advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement, isModal);
I used to the following Javascript code:

            // Dictionary containing the advanced template client object  
            // for a given RadScheduler instance (the control ID is used as key).  
            var schedulerTemplates = {};  
          
            function schedulerFormCreated(scheduler, eventArgs) {  
                // Create a client-side object only for the advanced templates  
                var mode = eventArgs.get_mode();  
                if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||  
                    mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {  
                    // Initialize the client-side object for the advanced form  
                    var formElement = eventArgs.get_formElement();    
                    var templateKey = scheduler.get_id() + "_" + mode;                
                    var advancedTemplate = schedulerTemplates[templateKey];                           
                    if (!advancedTemplate)  
                    {  
                        // Initialize the template for this RadScheduler instance  
                        // and cache it in the schedulerTemplates dictionary  
                        var schedulerElement = scheduler.get_element();  
                        var isModal = scheduler.get_advancedFormSettings().modal;  
                        advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement, isModal);  
                        advancedTemplate.initialize();  
                          
                        schedulerTemplates[templateKey] = advancedTemplate;  
                    }  
 
                    // Are we using Web Service data binding?  
                    if (!scheduler.get_webServiceSettings().get_isEmpty()) {  
                        // Populate the form with the appointment data  
                        var apt = eventArgs.get_appointment();  
                        var isInsert = mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert;  
                        var editSeries = eventArgs.get_editingRecurringSeries();  
                        advancedTemplate.populate(apt, isInsert, editSeries);  
                    }  
                }  
            }

Thanks,
Nick
0
Nick S
Top achievements
Rank 1
answered on 13 Nov 2009, 08:18 PM
I got it resolved.  My js file wasn't reference on the page correctly.  I fixed up the path and now it works.
Thanks again,
Nick
Tags
Scheduler
Asked by
Nick S
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Nick S
Top achievements
Rank 1
Share this question
or