search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Code Behind Usage: Calendar and Navigator cannot be instantiated in code behind?

Asked by Karsten
15 years ago.

Sorry for the repost, but I've spent nearly two days now trying to get the calendar/month controls and the navigator control to work inside a SharePoint WebPart and I have learnt some new facts which might make it easier to debug this..

This is to what I can reduce the problem: I've taken the navigator tutorial and got it working so that the navigator works fine with the calendar. Then I took the daypilotcalendar control and moved it from the aspx into the init of the code behind. The page renders fine and all except the navigation binding works. This is the code I have in the code behind.(It has the identical parameters as the asp.net tag):

protected override void OnInit(EventArgs e)
{

base.OnInit(e);

DayPilotCalendar1 = new DayPilotCalendar();
DayPilotCalendar1.ID = "DayPilotCalendar1";
DayPilotCalendar1.ClientObjectName = "dpc";
DayPilotCalendar1.DataStartField = "eventstart";
DayPilotCalendar1.DataEndField = "eventend";
DayPilotCalendar1.DataTextField = "name";
DayPilotCalendar1.DataValueField = "id";
DayPilotCalendar1.Days = 7;
DayPilotCalendar1.EventMoveHandling = DayPilot.Web.Ui.Enums.UserActionHandling.CallBack;
DayPilotCalendar1.EventMove += new DayPilot.Web.Ui.Events.EventMoveEventHandler(DayPilotCalendar1_EventMove);
DayPilotCalendar1.CssClassPrefix = "calendar_silver_";
// add it to the page
calDiv.Controls.Add(DayPilotCalendar1);

}

Any help is greatly appreciated!
Karsten

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.