Hello:I am having problems with a very simple page where I want to mimic the retrieval of appointments and their recurrence, and showing them on a WebWeeklyView. For that effect, I have hardcoded 2 appointments of which one is a recurrent appointment. When I do this experiment only with the 2 appointments, it works fine; however, when I add recurrence to one of them , the WeeklyView displays fine (including the recurrence icon) but when I double-click on any of the recurrent appointments it gives a jscript error. Here's the code:
DEFAULT.ASPX.CS
using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;// added by A.L.using Infragistics.WebUI.Shared;using Infragistics.WebUI.WebSchedule;// end
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
} private void Page_PreRender(object sender, EventArgs e) { this.WebScheduleInfo1.DataBind(); Appointment myAppointment = this.CreateAppointment("1"); this.WebScheduleInfo1.Activities.Add(myAppointment); // add second activity myAppointment = this.CreateAppointment("2"); this.WebScheduleInfo1.Activities.Add(myAppointment);
}
private Appointment CreateAppointment(string ActivityKey) { // Create an empty Activity owned by the WebScheduleInfo. Appointment appt = new Appointment(this.WebScheduleInfo1);
// Set pertinent properties on the Activity. appt.Subject = "Appointment Created at: "+ System.DateTime.Now.ToString(); double dOffset = Convert.ToDouble(ActivityKey); appt.StartDateTime = SmartDate.Parse(System.DateTime.Now.AddDays(dOffset).ToString()); appt.Duration = new TimeSpan(0, 30*int.Parse(ActivityKey), 0); int tempKey = int.Parse(ActivityKey); // RECURRENCE CREATION if (tempKey % 2 == 0) // create recurrence for appts with an even key { appt.CreateRecurrence(); Recurrence recurrenceObject = appt.Recurrence; recurrenceObject.Period = RecurrencePeriod.Daily; recurrenceObject.PeriodMultiple = 1; recurrenceObject.EndDateUtc = appt.StartDateTime.AddDays(2); recurrenceObject.Key = ActivityKey; } // END RECURRENCE CREATION // Set Key property to a unique value on each appointment. appt.Key = ActivityKey;
// Set ResourceKey property to link Activity with organizing Resource. appt.ResourceKey = this.WebScheduleInfo1.VisibleResources.UnassignedResource.Key; appt.Location = "My Location here"; appt.Description = "Customized decription"; appt.EnableReminder = false;
// Return the newly initialized Activity. return appt; } }
DEFAULT.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Infragistics2.WebUI.UltraWebToolbar.v7.3, Version=7.3.20073.38, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebToolbar" TagPrefix="igtbar" %>
<%@ Register Assembly="Infragistics2.WebUI.WebSchedule.v7.3, Version=7.3.20073.38, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.WebSchedule" TagPrefix="ig_sched" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Harmony: Appointment Weekly</title> <script type="text/javascript" > // JScript Filefunction OpenAppointmentDetail(oScheduleInfo, oEvent, oDialog, oActivity){ var eventID = oActivity.getDataKey(); var startDate = oActivity.getStartDateTime(); oEvent.cancel = true; /* Call different dialog */ window.open('AppointmentDetail.aspx?eventID=' + eventID + '&startDateTime=' + startDate);}function UltraWebToolbar1_Click(oToolbar, oButton, oEvent){switch (oButton.Key){ case "deleteTool": var weekView = ig_getWebWeekViewById("WebWeekView1"); /*var scheduleInfo = ig_getWebScheduleInfoById("WebScheduleInfo1");*/ var activity = weekView.getSelectedActivity(); if(activity != null) alert('Attempting to delete eventID = '+ activity.getDataKey()); if (activity == null) alert('Need to select an appointment to delete'); oEvent.needPostBack = false; break;}}</script></head><body> <form id="form1" runat="server"> <igtbar:UltraWebToolbar ID="UltraWebToolbar1" runat="server" BackColor="White" BackgroundImage="blueexplorer.gif" BorderStyle="None" Font-Names="Arial" Font-Size="8pt" ForeColor="Black" Height="22px" ImageDirectory="/ig_common/images/" ItemSpacing="0" ItemWidthDefault="80px" MovableImage="ig_tb_move03.gif" Width="551px"> <HoverStyle BackColor="Bisque" BackgroundImage="None" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px" Cursor="Default" Font-Names="Arial" Font-Size="8pt" ForeColor="Black"> </HoverStyle> <DefaultStyle BackgroundImage="blueexplorer.gif" BorderColor="Menu" BorderStyle="Solid" BorderWidth="0px" Font-Names="Arial" Font-Size="8pt" ForeColor="Black"> </DefaultStyle> <Items> <igtbar:TBarButton DisabledImage="" HoverImage="" Image="" SelectedImage="" Text="Delete" ToolTip="Delete Selected Appointment" Key="deleteTool"> </igtbar:TBarButton><igtbar:TBSeparator /> <igtbar:TBarButton DisabledImage="" HoverImage="" Image="" SelectedImage="" Text="Go To Parent" ToolTip="Go To Parent of Selected Appointment" Key="gotoParentTool"> </igtbar:TBarButton> <igtbar:TBSeparator /> </Items> <SelectedStyle BackColor="Orange" BackgroundImage="OrangeExplorer.gif" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px" Cursor="Default" Font-Names="Arial" Font-Size="8pt" ForeColor="Black"> </SelectedStyle> <ClientSideEvents Click="UltraWebToolbar1_Click" /> </igtbar:UltraWebToolbar> <div> <ig_sched:webweekview id="WebWeekView1" runat="server" webscheduleinfoid="WebScheduleInfo1"></ig_sched:webweekview> </div> <ig_sched:webscheduleinfo id="WebScheduleInfo1" runat="server" AppointmentFormPath="AppointmentDetail.aspx" > <ClientEvents ActivityDialogOpening="OpenAppointmentDetail" /> </ig_sched:webscheduleinfo> </form></body></html>
APPOITNMENTDETAIL.ASPX.CS
using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;
public partial class AppointmentDetail : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (Request.Params["eventID"] != null && Request.Params["eventID"].ToLower() != "null") { this.lblEventID.Text = "The appointment you selected is: " + Request.Params["eventID"]; } else { this.lblEventID.Text = "New Appointment requested on : " + Request.Params["startDateTime"]; } }}
APPOINTMENTDETAIL.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AppointmentDetail.aspx.cs" Inherits="AppointmentDetail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Harmony: Appointment Detail</title></head><body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Font-Size="XX-Large" Text="This is your appoinment Detail"></asp:Label><br /> <br /> <asp:Label ID="lblEventID" runat="server" Font-Size="Large" Text="The appointment you selected is ... "></asp:Label> </div> </form></body></html>
=====================================
This code works OK if I remove the block between // RECURRENCE CREATION and // END RECURRENCE CREATION in Deafault.aspx.cs.
Any help would be appreciated.
Thanks,
antonioalm
Did you solve your Recurrence problem?
I am also having same issue. My recurring appointments are not showing in webdayview.
I found the solution. Recurrence Key was not matching.