RadScedular Recurring Appointments Not visible

5 posts, 0 answers
  1. Vikas
    Vikas avatar
    2 posts
    Member since:
    May 2014

    Posted 26 May 2014 Link to this post

    Hi Support,

                       We liked your implementation of Scheduler control, It
    has some really cool features. we are planning to use it in one of our
    apps, so giving it a try with your most recent Control trials.

    We are using the Scheduler with Sql Database.
    The Table structure we followed was taken from here

    Now When i create the appointment without Recurrence all works fine.
    When we try to create appointment with recurrence the appointments are
    not getting displayed the first time. As i click on any of the
    links/buttons provided

    The datasource we used for binding is generic List of  business object called Appointment in our business layer.



    I am pasting the markup from our implementation below

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"><br>                        <AjaxSettings><br>                            <telerik:AjaxSetting AjaxControlID="RadAppointments"><br>                                <UpdatedControls><br>                                    <telerik:AjaxUpdatedControl ControlID="RadAppointments" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl><br>                                    <telerik:AjaxUpdatedControl ControlID="timer1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl><br>                                </UpdatedControls><br>                            </telerik:AjaxSetting><br>                        </AjaxSettings><br>                    </telerik:RadAjaxManager><br>                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"><br>                    </telerik:RadAjaxLoadingPanel><br>                    <telerik:RadScheduler ID="RadAppointments" Visible="true" runat="server" OverflowBehavior="Expand" Height="100%" DayStartTime="07:00:00" DayEndTime="19:00:00" RenderMode="Auto" EnableAdvancedForm="true"<br>                        OnClientFormCreated="OnClientFormCreated" OnAppointmentInsert="RadAppointments_AppointmentInsert" OnAppointmentUpdate="RadAppointments_AppointmentUpdate" EnableDescriptionField="true" OnAppointmentDelete="RadAppointments_AppointmentDelete"<br>                        AdvancedForm-EnableResourceEditing="true" CustomAttributeNames="CustomerName" StartInsertingInAdvancedForm="true" StartEditingInAdvancedForm="true" ShowFullTime="true"<br>                        EnableTheming="false" OnFormCreated="RadAppointments_FormCreated" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"><br><br>                        <AdvancedForm Modal="true" EnableCustomAttributeEditing="false" EnableResourceEditing="true"></AdvancedForm><br><br>                        <ResourceTypes><br>                            <telerik:ResourceType KeyField="Type" Name="Type" TextField="Type" ForeignKeyField="Type" DataSourceID="odsTypes"></telerik:ResourceType><br>                            <telerik:ResourceType KeyField="CustomerName" Name="CustomerName" ForeignKeyField="CustomerName" TextField="CustomerName" DataSourceID="odsCustomers"></telerik:ResourceType><br>                        </ResourceTypes><br>                        <AppointmentTemplate><br>                            <div style="font-style: italic; width: 100%"><br>                                Subiect:<br>                            <%# Eval("Subject") %><br>                            </div><br>                            <div style="font-style: italic; width: 100%;"><br>                                Type:<br>                            <%# Eval("Type.Text")%><br>                            </div><br>                            <div style="font-style: italic; width: 100%;"><br>                                Buyer Name:<br>                            <a href="customerlist.aspx" title="View Details"><%# Eval("CustomerName")%><img style="padding-left: 3px;" src="Images/eye.png" alt="view details" /></a><br>                            </div><br>                        </AppointmentTemplate><br>                        <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings><br>                        <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings><br>                    </telerik:RadScheduler><br><br>                    <asp:ObjectDataSource ID="odsCustomers" runat="server" SelectMethod="GetCustomerlist" TypeName="SqlHelper"></asp:ObjectDataSource><br>                    <asp:ObjectDataSource ID="odsTypes" runat="server" SelectMethod="getAppointmentType" TypeName="SqlHelper"></asp:ObjectDataSource><br><br><%--End Of markup %-->

    The Codebehind where the scheduler gets binded looks like below

     
    protected override void OnInit(EventArgs e)
            {
                if (!IsPostBack)
                {
                    InitializeAppointments();
    }
    }

    The code to insert and edit appointments are in the following handlers

    protected void RadAppointments_AppointmentInsert(object sender, Telerik.Web.UI.AppointmentInsertEventArgs e)
           {
               try
               {
                   //if (RadAppointments.Appointments.GetAppointmentsInRange(e.Appointment.Start, e.Appointment.End).Count > 0)
                   //{
                   //    e.Cancel = true;
                   //    ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose a different Time for Appointment!');", true);
                   //}
                   if (e.Appointment.Subject == String.Empty)
                   {
                       e.Cancel = true;
                   }
                   if (e.Appointment.Resources.Count == 0)
                   {
                       e.Cancel = true;
                       ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose appointment Type and Buyer Name!');", true);
                   }
                   if (e.Appointment.Resources.Count == 1)
                   {
                       if (e.Appointment.Resources[0].Type != "Type")
                       {
                           e.Cancel = true;
                           ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose appointment Type!');", true);
                       }
                       else
                       {
                           e.Cancel = true;
                           ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose a Buyer Name!');", true);
                       }
                   }
                   Appointment objAppointment = new Appointment();
                   objAppointment.Title = e.Appointment.Subject;
                   objAppointment.Start = e.Appointment.Start.ToUniversalTime()  ;
                   objAppointment.End = e.Appointment.End.ToUniversalTime();
                   objAppointment.Type = e.Appointment.Resources[0].Key.ToString();
                   objAppointment.ID_SalesRep = Convert.ToInt64(Session["UserID"]);
                   string customer = e.Appointment.Resources[1].Text.ToString();
                   int index = customer.IndexOf('-');
                   Int64 Id = 0;
                   if (index > 0)
                   {
                       Id = Int64.Parse(customer.Substring(0, index));
                       //customer = customer; //.Substring(index, customer.Length);
                   }
      
                   objAppointment.ID_Customer = Id; // Convert.ToInt64(e.ModifiedAppointment.Resources[1].Key);
                   objAppointment.CustomerName = customer;//e.ModifiedAppointment.Resources[1].Text.ToString();
                   //objAppointment.ID_Customer = Convert.ToInt64(e.Appointment.Resources[1].Key);
                   //objAppointment.CustomerName = e.Appointment.Resources[1].Text.ToString();
                   objAppointment.Description = e.Appointment.Description;
                   objAppointment.RecurrenceRule = e.Appointment.RecurrenceRule;
                     
                   objAppointment.AddAppointment();
                   InitializeAppointments();
      
               }
               catch (Exception ex)
               {
                   e.Cancel = true;
                   Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
               }
           }
      
           protected void RadAppointments_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)
           {
               try
               {
                   //if (RadAppointments.Appointments.GetAppointmentsInRange(e.ModifiedAppointment.Start, e.ModifiedAppointment.End).Count > 0)
                   //{
                   //    foreach (Telerik.Web.UI.Appointment a in RadAppointments.Appointments.GetAppointmentsInRange(e.ModifiedAppointment.Start, e.ModifiedAppointment.End))
                   //    {
                   //        if (a.ID != e.Appointment.ID)
                   //        {
                   //            e.Cancel = true;
                   //        }
                   //    }
                   //}
      
                   if (e.ModifiedAppointment.Subject == String.Empty)
                   {
                       e.Cancel = true;
                   }
                   if (e.ModifiedAppointment.Resources.Count == 0)
                   {
                       e.Cancel = true;
                       ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose appointment Type and Buyer Name!');", true);
                   }
                   if (e.ModifiedAppointment.Resources.Count == 1)
                   {
                       if (e.ModifiedAppointment.Resources[0].Type != "Type")
                       {
                           e.Cancel = true;
                           ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose appointment Type!');", true);
                       }
                       else
                       {
                           e.Cancel = true;
                           ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose a Buyer Name!');", true);
                       }
                   }
      
      
                   Appointment objAppointment = Appointment.GetAppointment(Convert.ToInt64(e.ModifiedAppointment.ID));
                   objAppointment.ID = objAppointment.ID;
                   objAppointment.Title = e.ModifiedAppointment.Subject;
                   objAppointment.Start = e.ModifiedAppointment.Start.ToUniversalTime();
                   objAppointment.End = e.ModifiedAppointment.End.ToUniversalTime();
                   objAppointment.ID_SalesRep = Convert.ToInt64(Session["UserID"]);
                   string customer = e.ModifiedAppointment.Resources[1].Text.ToString();
                   int index = customer.IndexOf('-');
                   Int64 Id = 0;
                   if (index > 0)
                   {
                       Id = Int64.Parse(customer.Substring(0, index));
                       //customer = customer; //.Substring(index, customer.Length);
                   }
      
                   objAppointment.ID_Customer = Id; // Convert.ToInt64(e.ModifiedAppointment.Resources[1].Key);
                   objAppointment.CustomerName = customer;//e.ModifiedAppointment.Resources[1].Text.ToString();
                   objAppointment.Description = e.ModifiedAppointment.Description;
                   objAppointment.UpdateAppointment();
                   InitializeAppointments();
               }
               catch (Exception ex)
               {
                   e.Cancel = true;
                   Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
      
               }
           }


    Please help us with this issue. we are looking forward to hear from you soon.







    Regards,

    Vikas Joshi

    Beyondkey pvt. Ltd.

    India

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 28 May 2014 Link to this post

    Hello Vikas ,

    We demonstrate implementing very similar scenario in our RadScheduler Binding to Generic List demo. As you can notice the RadScheduler is bound to list of custom appointment class objects and creating and showing recurring appointments works fine. The appointment class definition is also available at the bottom the code behind file. For the demo purposes the appointments are stored and retrieved from the session but you are absolutely able to use any kind of data source including object data source.

    I noticed that you have opened identical forum thread where I did provide same answer to your question. In order to avoid any further confusions I would suggest continuing the communication in this thread.

    Please do not hesitate to contact us if you need any further assistance.

    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris
    Chris avatar
    13 posts
    Member since:
    Oct 2010

    Posted 26 Jun 2014 Link to this post

    Seeing a similar problem as VIkas. Used your Binding to a Generic List demo code with very few modifications and while regular Appointments show fine, recurring Appointments are not showing in the Schedule control. In our generic object we dropped "userID" and "reminder." Data is fine in the backend complete with RRules. Updating to the latest now to see if it's an issue with the version we're using.
  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 27 Jun 2014 Link to this post

    Hello,

    Could you please confirm that you are facing that problem when you test our live demo. For example if you add an recurring appointment does that appointment show in the RadScheduler as expected? Also please test our demo without any modification and let us know how that worked. If there is no problem please share what modification you have done so we can inspect and assist you any further.


    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Chris
    Chris avatar
    13 posts
    Member since:
    Oct 2010

    Posted 27 Jun 2014 in reply to Boyan Dimitrov Link to this post

    Hello Boyan,  I have just now realized that the problem was in fact with the data.

    While a regular Appointment item uses DataStartField and DataEndField, a recurrent Appointment ignores those and uses only the DTSTART and DTEND prepended to the RRULE string.

    DTSTART:20140627T170000Z
    DTEND:20140627T210000Z

    RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU
    EXDATE:20140628T170000Z,20140627T170000Z

    While adding records to our DB I merely had to make sure the recurrence rule had the proper date added.

    RecurrenceRule rFix;
    RecurrenceRule.TryParse(dte_recurrence.RecurrenceRule.ToString(), out rFix);
    rFix.Range.Start = Convert.ToDateTime(dte_start.SelectedDate);
    rFix.Range.EventDuration = Convert.ToDateTime(dte_end.SelectedDate) - Convert.ToDateTime(dte_start.SelectedDate);





Back to Top
UI for ASP.NET Ajax is Ready for VS 2017