Set custom Advanced Form from code-behind

12 posts, 0 answers
  1. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 23 Nov 2009 Link to this post

    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.
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Nov 2009 Link to this post

    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.
  3. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 24 Nov 2009 Link to this post

    Thank you very much. I tried this approach, but when I click in the scheduler, no form appears. Why is this so?
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Nov 2009 Link to this post

    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.
  5. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 24 Nov 2009 Link to this post

    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.
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Nov 2009 Link to this post

    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.
  7. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 24 Nov 2009 Link to this post

    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?

  8. Joe Buckle
    Joe Buckle avatar
    47 posts
    Member since:
    Nov 2009

    Posted 25 Nov 2009 Link to this post

    I got this figured out. Thanks. :)
  9. Nina
    Nina  avatar
    5 posts
    Member since:
    May 2008

    Posted 21 Jul 2010 Link to this post

    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...
  10. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 26 Jul 2010 Link to this post

    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
  11. Amit
    Amit avatar
    10 posts
    Member since:
    Feb 2011

    Posted 15 Feb 2011 Link to this post

    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

  12. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 Feb 2011 Link to this post

    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.
Back to Top