+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Custom Appointmet Template

Custom Appointmet Template

12 posts, 0 answered
  1. Coolhand
    Coolhand avatar
    12 posts
    Registered:
    13 Dec 2007
    10 Jul 2008
    Link to this post
    I am trying to implement a custom appointment template in the Evens Schedule View user control. What I cant figure out is how to get the category for the event so that it can bu used as a css style. Here is what I have for the template so far:
    <AppointmentTemplate> 
        <div class="rsCustomAppointmentContainer Category_Here"
            <%# Eval("Subject") %> 
        </div> 
    </AppointmentTemplate> 

    Thanks in advance for the help.
    Luke


  2. Joe
    Joe avatar
    138 posts
    Registered:
    24 Sep 2012
    11 Jul 2008
    Link to this post
    Hi Luke, 

    In the ~/Sitefinity/ControlTemplates/Events/ContentViewItemList.ascx template, Category is bound using the following code:

     <class="sf_postCategory"
                    <asp:Literal ID="CategoryLiteral" runat="server" Text="Category" /><asp:HyperLink ID="Category" runat="server" /> 
                </p> 

    Because Category is a meta field, you just need to bind a control's ID property to the name of the field. In your case, you would want to add the code above to the repeater control. Keep in mind that this binding will only work with controls that implement the ITextControl interface. For more information on binding meta fields, please view the  Adding Custom Meta Fields section of our user manual.

    If you have any other questions, feel free to call or e-mail me.

    Thanks,

    Joe
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Coolhand
    Coolhand avatar
    12 posts
    Registered:
    13 Dec 2007
    11 Jul 2008
    Link to this post
    Maybe I wasn't clear but I am trying to edit the Appointment Template in the RadScheduler that is in the template file ~/Sitefinity/ControlTemplates/Events/EventsScheduleView.ascx.

    <telerik:RadScheduler ID="eventsSchedule" SelectedView="MonthView" OverflowBehavior="Expand" EnableEmbeddedSkins="False" Skin="GolbonPublic08" runat="server"
        <TimelineView UserSelectable="false" /> 
        <AppointmentTemplate> 
            <div class="rsCustomAppointmentContainer Category_Here"
                <%# Eval("Subject") %> 
            </div> 
        </AppointmentTemplate> 
    </telerik:RadScheduler> 

    Since I am modifying a template of the RadScheduler the metadata binding doesn't work, as far as I can tell. I have tried several approaches, to no avail.

    Do you have any other ideas?

    Again, thanks for your help,
    Luke
  4. Joe
    Joe avatar
    138 posts
    Registered:
    24 Sep 2012
    11 Jul 2008
    Link to this post
    Hi Luke,

    I am sorry to hear that meta binding did not work for the RadScheduler.

    In my example, I was trying to say use code from ContentViewItem.ascx and paste it into the appointment template. I will consult my co-workers regarding a solution for the RadScheduler and we shall get back to you early next week. In the meantime, feel free to contact us regarding any other technical inquiries.

    Have a nice weekend!

    All the best,

    Joe
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Coolhand
    Coolhand avatar
    12 posts
    Registered:
    13 Dec 2007
    14 Jul 2008
    Link to this post
    I finally figured out how to get the category in the appointment template. See my code below.
    <telerik:RadScheduler ID="eventsSchedule" SelectedView="MonthView" OverflowBehavior="Expand" EnableEmbeddedSkins="False" Skin="GolbonPublic08" runat="server"
        <TimelineView UserSelectable="false" /> 
        <AppointmentTemplate> 
            <div class="rsCustomAppointmentContainer rs<%# (new Telerik.Events.EventsManager("Events")).GetEvent(new Guid(Container.Appointment.ID.ToString())).ContentItem.GetMetaData("Category").ToString().Replace(" ","_").Replace("&","and") %>"> 
                <%# Eval("Subject") %> 
            </div> 
        </AppointmentTemplate> 
    </telerik:RadScheduler> 
    It took a lot of digging through the API with a bunch of trial and error.

    Thanks for the help provided. If you see any improvements to my solution let me know.

    Thanks,
    Luke
  6. GD
    GD avatar
    2 posts
    Registered:
    27 Jul 2009
    27 Jul 2009
    Link to this post
    I want to add a user control in the AppointmentTemplate. Each period may contain various schedules with different colors and may have diffrent images.
    How I can implement this?
    Please help me.
    Thanks.
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 Jul 2009
    Link to this post
    Hi gd a,

    You need to create a custom control that inherits from EventsScheduleView and manage the AppointmentCreated event. Below is a sample code.

    public class CustomEventsScheduleView : EventsScheduleView 
        public CustomEventsScheduleView() 
        { 
        } 
        public override string LayoutTemplatePath 
        { 
            get 
            { 
                if (string.IsNullOrEmpty(this.layoutTemplatePath)) 
                    this.layoutTemplatePath = "~/Sitefinity/ControlTemplates/Events/EventsScheduleView.ascx"
                return this.layoutTemplatePath; 
            } 
            set 
            { 
                this.layoutTemplatePath = value; 
            } 
        } 
        protected override void InitializeControls(System.Web.UI.Control controlContainer) 
        { 
            EventsSchedule.AppointmentCreated += new AppointmentCreatedEventHandler(EventsSchedule_AppointmentCreated); 
            base.InitializeControls(controlContainer); 
        } 
        void EventsSchedule_AppointmentCreated(object sender, AppointmentCreatedEventArgs e) 
        { 
         // add logic here 
        } 
     
        private string layoutTemplatePath; 
     


    All the best,
    Ivan Dimitrov
    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.
  8. GD
    GD avatar
    2 posts
    Registered:
    27 Jul 2009
    28 Jul 2009
    Link to this post
    I want to create a user control in which I want to bind the ID of the appointment(invisible), Subject of the appintment, what image to show in the appintment or not, background color for that appointment/schedule. Backgroung color and image can be different for different appointments.
    How I can do this using a web user control (.ascx)? I am new to telerik. Help me in details.
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Jul 2009
    Link to this post
    Hi gd a,

    I suggest that you should use custom control instead of user. EventsScheduleView control in Sitefinity is RadSchedule control. You can gather more information about the control events and behavior from RadScheduler for ASP.NET AJAX and RadSchedule demo.

    All the best,
    Ivan Dimitrov
    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.
  10. VB.Net
    VB.Net avatar
    2 posts
    Registered:
    17 Aug 2009
    18 Aug 2009
    Link to this post
    Hi,
    I am using RADScheduler, and it is in a usercontrol (say Month.ascx). I have created a usercontrol (say Template.ascx) for AppintmentTemplate, and I added the following code for the click event of the template user control (Template.ascx). :

    Me.parentDiv.Attributes.Item("OnClick") = Me.Page.ClientScript.GetPostBackEventReference(Me"Click")
     
     

    In Template.ascx, I implemented IPostBackEventHandler and RaisePostBackEvent. Now I want catch the bubble event in Month.ascx OnBubbleEvent. as below: 

     

     

    Protected Overrides Function OnBubbleEvent(ByVal sender As ObjectByVal e As EventArgs) As Boolean   
        Return False ' To return to the parent aspx page.   
    End Function

    The Click event on Template User control is raising the postback, but I am not able to catch the bubbleevent on the month user control's OnBubbleEvent...

    Waiting for your reply...
    Thanks.

  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Aug 2009
    Link to this post
    Hello VB.Net,

    The child control raise the bubble event and this event is bubbled to the parent. It is not possible to bubble this event in another control.

    All the best,
    Ivan Dimitrov
    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.
  12. VB.Net
    VB.Net avatar
    2 posts
    Registered:
    17 Aug 2009
    26 Aug 2009
    Link to this post
    I have added code for AppointmentClick as below:
    Protected Sub rsMonthView_AppointmentClick(ByVal sender As System.ObjectByVal e As Telerik.Web.UI.SchedulerEventArgs) Handles rsMonthView.AppointmentClick  
        '' i want to raise custom event here.
    End Sub

    But it is not working, means it did not get fired by clicking on any Appintment.

     

     

    I want to raise postback event when a user clicks on the Appointment Template, I want to catch it in the

    RaisePostBackEvent of System.Web.UI.IPostBackEventHandler (that I already implemented). But this is not working. How I can do it?

     

     

     

Register for webinar
12 posts, 0 answered