I also would like to use DayPilot in a SharePoint web part. Could you give us an update on your plans for supporting this?
Thanks,
Dennis
Dan,
I have the scheduler control working fine in an aspx page, with a bubble and a context menu. I refactored the code into a web part and installed it into SharePoint. The schedule data is displaying properly, but the time zoom, context menu and bubble are not working. The relevant parts of my web part code are included below.
Do you have a working SharePoint web part example that you could share?
public class TimeWebPart : WebPart { protected DayPilotScheduler schedule; protected DayPilotBubble bubble; protected DayPilotMenu menu; protected override void CreateChildControls() { schedule = new DayPilotScheduler(); this.Controls.Add(schedule); bubble = new DayPilotBubble(); this.Controls.Add(bubble); menu = new DayPilotMenu(); this.Controls.Add(menu); } protected override void Render(HtmlTextWriter writer) { PopulateSchedulerControl(); schedule.RenderControl(writer); bubble.RenderControl(writer); menu.RenderControl(writer); }
protected void PopulateSchedulerControl() { // Initialize the schedule control. schedule.DataStartField = "start"; schedule.DataEndField = "end"; schedule.DataResourceField = "resource"; schedule.DataTextField = "name"; schedule.DataValueField = "id"; schedule.DataTagFields = "id"; schedule.ClientObjectName = "dps1"; schedule.StartDate = DateTime.Parse("1/1/2008"); schedule.Days = 90; schedule.CellDuration = 1440; schedule.CellGroupBy = DayPilot.Web.Ui.Enums.GroupByEnum.Week; schedule.CellWidth = 30; schedule.Refresh += new DayPilot.Web.Ui.Events.RefreshEventHandler(Schedule_Refresh); schedule.BeforeTimeHeaderRender += new DayPilot.Web.Ui.Events.BeforeTimeHeaderRenderEventHandler(Schedule_BeforeTimeHeaderRender); // ... // Configure the bubble control. bubble.ID = "Bubble"; bubble.ClientObjectName = "bubble"; bubble.RenderContent += new DayPilot.Web.Ui.Events.BubbleRenderContentEventHandler(Bubble_RenderContent); schedule.BubbleID = bubble.ID; // Configure the context menu. menu.ID = "ContextMenu"; MenuItem item = new MenuItem(); item.Text = "Edit..."; item.Action = MenuItemAction.NavigateUrl; item.NavigateUrl = "http://158.228.58.211:5555/CRMVPC/userdefined/edit.aspx?etc=10004&id={{0}}"; item.NavigateUrlTarget = "_blank"; menu.MenuItems.Add(item); schedule.ContextMenuID = menu.ID; }
I changed the BubbleID and ContextMenuID properties of the scheduler control to used the UniqueID property of the bubble and context menu controls in theweb part Render method,like this:
schedule.BubbleID = bubble.UniqueID; schedule.ContextMenuID = menu.UniqueID;
The time zoom, bubble, and context menu are still not working in my SharePoint web part. Did I follow your directions properly?
I moved the control initialization to CreateChildControls (see code below), but it is still not working.
By the way, we are very impressed by your controls and your responsiveness in this forum.
public class TimeWebPart : WebPart, INamingContainer { protected DayPilotScheduler schedule; protected DayPilotBubble bubble; protected DayPilotMenu menu; protected override void CreateChildControls() { // DayPilot bubble control bubble = new DayPilotBubble(); bubble.ID = "Bubble"; bubble.ClientObjectName = "bubble"; bubble.RenderContent += new DayPilot.Web.Ui.Events.BubbleRenderContentEventHandler(Bubble_RenderContent); this.Controls.Add(bubble); // DayPilot menu control menu = new DayPilotMenu(); menu.ID = "ContextMenu"; MenuItem item = new MenuItem(); item.Text = "Edit..."; item.Action = MenuItemAction.NavigateUrl; item.NavigateUrl = "http://158.228.58.211:5555/CRMVPC/userdefined/edit.aspx?etc=10004&id={{0}}"; item.NavigateUrlTarget = "_blank"; menu.MenuItems.Add(item); this.Controls.Add(menu); // DayPilot schedule control schedule = new DayPilotScheduler(); schedule.BubbleID = bubble.UniqueID; schedule.ContextMenuID = menu.UniqueID; this.Controls.Add(schedule); } protected override void Render(HtmlTextWriter writer) { PopulateSchedulerControl(); schedule.RenderControl(writer); bubble.RenderControl(writer); menu.RenderControl(writer); }
I made the change (in the CreateChildControls method), with mixed results. The good news is that the context menu now works! The bad news is that the bubble and the links in the time header to zoom in/out still do not work.
I looked at the page source, and found the following lines in the dps1_Init() function:
v.contextMenu = ctl00_m_g_07110d78_1a9a_4287_8fdc_86738c0c08ca_ContextMenu; v.bubble = bubble;
It looks like its getting the ID of the context menu control properly, but not that of the bubble control.
The page being generated by SharePoint 2007 does not contain a <!DOCTYPE> declaration.