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

[Solved] AppointmentTemplate problem

5 Answers 246 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 12 Oct 2009, 01:47 PM
Hello,

I have strange problem with AppointmentTemplate.Even if I declared my custom template, I can still see only the built in one.I am stuck on this for few hours and cannot get it to work.Please can You give me some advice.I am using Web service binding in ASP.NET MVC
Here is my code:


<%@ Page Title="" Language="C#" AutoEventWireup="true" MasterPageFile="~/Views/Shared/Site.Master"
    Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%= Html.PageTitle() %>
</asp:Content>

<script runat="server">

    protected override void OnLoad(EventArgs e)
    {
        RadScheduler1.Culture = CRM.Web.Code.Globalization.GlobalizationManager.CurrentUICulture;
        base.OnLoad(e);
    }
</script>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form runat="server">
    <h2>
        <%= Html.PageTitle() %></h2>

    <script type="text/javascript">

        /* Firefox resize scrollable content */
        function hideScrollableArea(sender, eventArgs) {
            if ($telerik.isFirefox)
                $telerik.$('.rsContentScrollArea').css('overflow', 'hidden');
        }
        function showScrollableArea(sender, eventArgs) {
            if ($telerik.isFirefox)
                $telerik.$('.rsContentScrollArea').css('overflow', 'auto');
        }

        function OnClientAppointmentDoubleClick(sender, eventArgs) {
            var apt = eventArgs.get_appointment();

            document.location = '<%= HttpContext.Current.CreateUrl("/Appointment/Detail/") %>' + apt._id;
        }

        function OnClientTimeSlotClick(sender, eventArgs) {

            document.location = '<%= HttpContext.Current.CreateUrl("/Appointment/Create?") %>StartTime=' + eventArgs.get_time().format('dd/MM/yyyy H:mm');
        }
        //]]>


    </script>

    <telerik:RadScheduler runat="server" ID="RadScheduler1" AllowDelete="false" AllowEdit="true"
        AllowInsert="false" StartEditingInAdvancedForm="false" OnClientAppointmentDoubleClick="OnClientAppointmentDoubleClick"
        OnClientTimeSlotClick="OnClientTimeSlotClick" Height="900px">
        <AppointmentTemplate>
            <div>
                Test :
                <%= Eval("Subject") %>
            </div>
        </AppointmentTemplate>
        <TimelineView GroupBy="Calendar" GroupingDirection="Vertical" />
        <WebServiceSettings Path="~/Models/SchedulerWebService.asmx" />
    </telerik:RadScheduler>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableScriptLocalization="true"
        EnableScriptGlobalization="true">
    </telerik:RadScriptManager>
    </form>
</asp:Content>

5 Answers, 1 is accepted

Sort by
0
Scott Laughton
Top achievements
Rank 1
answered on 13 Oct 2009, 04:20 AM
Jan,
    I am using InLineInsertTemplate and InLineEditTemplate's and I had to use the following properties to get the Edit one to show:

RadScheduler1.AdvancedForm.Enabled = false;
RadScheduler1.StartInsertingInAdvancedForm = false;
RadScheduler1.StartEditingInAdvancedForm = false;

Hope this helps ;-)

Scott
0
Jan
Top achievements
Rank 1
answered on 13 Oct 2009, 07:56 AM
Hello Scott,

Thank You for Your reply. I gave all my hopes into Your solution, but it doesn´t work for me. I can´t work it out why the template is not used by Scheduler. Actually I found another issue - I have registered OnClientAppointmentMoving="OnClientAppointmentMoving"

 

function OnClientAppointmentMoving(sender, eventArgs) {

 

 

var apt = eventArgs.get_appointment();
apt.get_allowEdit();
}

but apt.get_allowEdit(); returns undefined only.I programatically set appointment appointment.AllowEdit = false; in my

 

GetAppointments method.
I am doing this because I need to disable editing on some appointments.

I hope someone have a solution for me.Thank You so much.

0
Peter
Telerik team
answered on 13 Oct 2009, 10:10 AM
Hi Jan,

RadScheduler does not support AppointmentTemplate for Client Side binding mode. Please, excuse us for this limitation of the control.


Cheers,
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
Jan
Top achievements
Rank 1
answered on 13 Oct 2009, 10:30 AM
Hello,

thank You for reply. So I haven´t got any chance to use Templates with ASP.NET MVC right?
But still, I have a second problem in my OnClientAppointmentMoving function. I fetch Appointments in my SchedulerProvider, where I also set Apointment.AllowEdit property and in  OnClientAppointmentMoving function this property is undefined (I am using get_allowEdit();).
Complete code snippet is in my last post.

Thank You again
 
0
Peter
Telerik team
answered on 15 Oct 2009, 11:53 AM
Hello Jan,

Currently, this is a limitation of RadScheduler. Only certain properties such as Start, End, and Subject are serialized and sent to the client. We plan to remove this drawback in the near future. Meanwhile, you can use custom attributes as a workaround. Here is how:

your provider class:
public override IEnumerable<Appointment> GetAppointments(RadScheduler owner)
{
    //* * * 
    apt.Attributes["allowEdit"] = "false";
        //* * *

aspx:
<script type="text/javascript">
      function OnClientAppointmentDataBound(sender, eventArgs)
      {          
          var allowEditValue = eventArgs.get_appointment().get_attributes().getAttribute("allowEdit")
          if(allowEditValue == "false")
              eventArgs.get_appointment().set_allowEdit(false);
      }
  </script>
  <telerik:RadScheduler runat="server" ID="RadScheduler1" OnClientAppointmentDataBound="OnClientAppointmentDataBound">


Kind regards,
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.
Tags
Scheduler
Asked by
Jan
Top achievements
Rank 1
Answers by
Scott Laughton
Top achievements
Rank 1
Jan
Top achievements
Rank 1
Peter
Telerik team
Share this question
or