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

Set custom Advanced Form from code-behind

11 Answers 264 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Joe Buckle
Top achievements
Rank 1
Joe Buckle asked on 23 Nov 2009, 02:03 PM
Good day!

A requirement in my project is to dynamically create schedulers. I'm already able to achieve that, but I also want to customize the AdvancedInsertTemplate/AdvancedEditTemplate. How do I do this from code-behind, since I'm creating a scheduler from code-behind too?

Thank you very much.

11 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Nov 2009, 03:11 PM
Hello Joe,

Similarly to this kb article, you can add AdvancedInsert or AdvancedEdit template dynamically like this:

public partial class Default13 : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
         
        RadScheduler1.AdvancedInsertTemplate = new AppInsertTemplate ();
         
    }    
      
}
  
public class AppInsertTemplate : IBindableTemplate
{
    #region IBindableTemplate Members
  
    public System.Collections.Specialized.IOrderedDictionary ExtractValues(Control container)
    {
        throw new NotImplementedException();           
    }
    #endregion
  
    #region ITemplate Members
  
    public void InstantiateIn(Control container)
    {
        RadTextBox subject = new RadTextBox();
        subject.Text = "test";
        container.Controls.Add(subject);
    }
    #endregion
}

The above code is just a simple example which shows how to add RadTextBox to the advanced form. For adding more functionality, I suggest you refer to the source code of the AdvancedTemplate, AdvancedInsertTemplate and AdvancedEditTemplate classes which I have attached for reference.  


Greetings,
Peter
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.
0
Joe Buckle
Top achievements
Rank 1
answered on 24 Nov 2009, 01:38 PM
Thank you very much. I tried this approach, but when I click in the scheduler, no form appears. Why is this so?
0
Peter
Telerik team
answered on 24 Nov 2009, 02:18 PM
Hello Joe,

You need to double click on a time slot or an appointment. With default settings, this will cause the inline insert or edit form to show up. Then you need to click on the "options" link to open the advanced insert or edit form. If you want to open the advanced form directly, you need to the following RadScheduler's properties:

StartInsertingInAdvancedForm="true"
StartEditingInAdvancedForm="true"


Greetings,
Peter
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.
0
Joe Buckle
Top achievements
Rank 1
answered on 24 Nov 2009, 02:57 PM
Good day!

Yes, I have set StartInsertingInAdvancedForm="true" and StartEditingInAdvancedForm="true", and also double-clicking, but nothing appears. Without setting a custom form/template, the default form/template shows.

Thanks.
0
Peter
Telerik team
answered on 24 Nov 2009, 03:09 PM
Hi Joe,

Probably, you are using the modal popup form (<AdvancedForm Modal="true" />). If that's the case, please see this help topic:
http://www.telerik.com/help/aspnet-ajax/scheduler-custom-modal-advanced-template.html

You need to implement the html provided in the above article in your dynamic template. I suggest you first experiment with the code declaratively to just to check what result it will yield.


Greetings,
Peter
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.
0
Joe Buckle
Top achievements
Rank 1
answered on 24 Nov 2009, 11:53 PM
Thank you very much. I got part of this working. :)
But from the IBindableTemplate, how would I be able to know if the mode is Insert or Edit?

0
Joe Buckle
Top achievements
Rank 1
answered on 25 Nov 2009, 02:09 PM
I got this figured out. Thanks. :)
0
Nina
Top achievements
Rank 1
answered on 21 Jul 2010, 04:40 PM
Yes, but is there a way to open the advanced form in behindcode, without relying on the double-click in RadScheduler?  I'm trying to trigger the advanced form opening based on a contextmenu click...
0
Peter
Telerik team
answered on 26 Jul 2010, 11:33 AM
Hi Nina ,

You can use the following server-side methods:

RadScheduler1.ShowAdvancedEditForm()
RadScheduler1.ShowAdvancedInsertForm()


Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Amit
Top achievements
Rank 1
answered on 15 Feb 2011, 10:48 AM
Hi Telerik Team,

I am facing a problem while using advance insert template. I need to change the back color of appointments. That will be done using a status field which is in database. There are three status flags.
  1. Approve
  2. Pending
  3. Reject

    
For each status I need to show the back-ground color of appointments.

Initailly the color will be orange that indicates 'Pending' Status.

After approval, that will affect in databse & the appointment back color will be changed from Orange to Green, that indicates 'Approved' Status.

And after rejection, the appointments back color will be shown in Red Color which will also reflect into the databse (i.e. 'Rejected' Status).

So is it possible in case of using AdvanceInsert Template.?

As i have referred many examples & it is shown using appointment_databound().

But as I am using advance isnert template, I need to use the property which are form_creating, form_created & radscheduler_command property. So where should i write the code for diffrent appointment according to their status.

please revert as soon as possible.

Thanks & Regards
Amit Thakkar

0
Peter
Telerik team
answered on 15 Feb 2011, 03:21 PM
Hello Amit,

You can use custom attributes to store the color of the appointment. Such an approach is used in the Advanced Templates demo which you can use for reference.


Kind regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
Joe Buckle
Top achievements
Rank 1
Answers by
Peter
Telerik team
Joe Buckle
Top achievements
Rank 1
Nina
Top achievements
Rank 1
Amit
Top achievements
Rank 1
Share this question
or