我正在使用 DayPilot Lite 控件创建计划。我想为每个事件添加附加信息,但不能通过连接定位属性。
我的数据源:
protected IEnumerable<Schedule> GetUserSched(int userId)
{
var query = (from i in _context.UserScheduleMaps
where i.UserId == userId
select i.ScheduleId).ToList();
var sched = (from i in _context.Schedules
join r in _context.Rooms
on i.RoomId equals r.RoomId
where query.Contains(i.ScheduleId)
select i).ToList();
return sched;
}
如果我从第一个表而不是连接表中定位属性,则添加其他属性有效:
protected void calSched1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs e)
{
if (e.DataItem.Source != null)
{
// e.DataItem["Room.RoomNameOrNumber"] ?
string location = e.DataItem["RoomId"] as string;
e.Html = e.Text + ", room: " + location;
}
}
如何定位联接表中的属性?