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

Exception (DataItem doesn't hold any source object)

Asked by Mangesh Kapse
8 years ago.

Hi,
I get this exception if the calendar has the BeforeEventRender event. Why this happen?
This happen because the Source is null, how I can set this property?

Answer:-
Add PreRender Event of Daypilot and Bind DayPilotCalander ,
like
protected void DayPilotCalendar1_PreRender(object sender, EventArgs e)
{
BindDayPilotBookings();
}

protected void BindDayPilotBookings()
{
DayPilotCalendar1.StartDate = Convert.ToDateTime(DateTime.Today);
DayPilotCalendar1.BusinessBeginsHour = 9;
DayPilotCalendar1.BusinessEndsHour = 20;
DataTable dt = BAL_Class.GetAllBookingsByAdmin();
DayPilotCalendar1.DataSource = dt;
DayPilotCalendar1.DataStartField = "Start_Time";
DayPilotCalendar1.DataEndField = "End_Time";
DayPilotCalendar1.DataTextField = "Agenda";
DayPilotCalendar1.DataIdField = "Booking_Id";
DayPilotCalendar1.ItemType = "Status";
DayPilotCalendar1.DataBind();
}

Answer posted by Dan Letecky [DayPilot]
8 years ago.

I'm including your answer as a special post and marking the questions as answered. Thanks for posting your solution.

Answer:-
Add PreRender Event of Daypilot and Bind DayPilotCalander ,
like

protected void DayPilotCalendar1_PreRender(object sender, EventArgs e) 
{ 
BindDayPilotBookings(); 
}

protected void BindDayPilotBookings() 
{ 
DayPilotCalendar1.StartDate = Convert.ToDateTime(DateTime.Today); 
DayPilotCalendar1.BusinessBeginsHour = 9; 
DayPilotCalendar1.BusinessEndsHour = 20; 
DataTable dt = BAL_Class.GetAllBookingsByAdmin(); 
DayPilotCalendar1.DataSource = dt; 
DayPilotCalendar1.DataStartField = "Start_Time"; 
DayPilotCalendar1.DataEndField = "End_Time"; 
DayPilotCalendar1.DataTextField = "Agenda"; 
DayPilotCalendar1.DataIdField = "Booking_Id"; 
DayPilotCalendar1.ItemType = "Status"; 
DayPilotCalendar1.DataBind(); 
}
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.