【问题标题】:Telerik scheduler appointments in different colors不同颜色的 Telerik 调度程序约会
【发布时间】:2011-12-12 12:04:53
【问题描述】:

我正在从数据表中读取约会。这是我的代码:

       List<MyClass> myObjects = (from e in myEntities.Mytable where
                              e.DateFrom >= schedulerInfo.ViewStart &&
                              e.DateTo <= schedulerInfo.ViewEnd
                              select e).ToList();


        List<Appointment> appointments = new List<Appointment>(myObjects.Count);
        foreach (MyClass e in myObjects) {
            Appointment a = new Appointment();
            a.ID = e.ID;
            a.Subject = e.Description;
            a.Start = e.DateFrom;
            a.End = e.DateTo;
            a.BackColor = System.Drawing.Color.Yellow;
            appointments.Add(a);

当我运行它时,它不是黄色的!

【问题讨论】:

    标签: telerik scheduler


    【解决方案1】:

    要更改 RadScheduler 中约会的颜色,您必须订阅 OnAppointmentDataBound event。正如在this documentation article 中所见,您所要做的就是从e.Appointment 中获取当前约会对象并定义BackColor(和其他可用属性),您就应该准备好了!

    【讨论】:

    • 您如何将数据绑定到 RadScheduler?此外,您是通过标记还是通过在代码隐藏中添加事件处理程序来订阅 OnAppoitnmentDataBound 事件?
    • 实际上,如果您使用 Web 服务填充 RadScheduler,AppointmentDataBound 将不会触发。我应该改用 OnClientAppointmentDataBound。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    • 1970-01-01
    • 2012-08-13
    • 2020-05-15
    • 1970-01-01
    相关资源
    最近更新 更多