[翻译]ASP.NET日计划控件

英文源文档 <http://www.codeproject.com/KB/webforms/daypilot_scheduler.aspx>

代码下载:DayPilotLite-3_0_209.zip (敏捷学院)

特点

主要特点:

  • 简单干净的外观
  • Y轴上允许多资源
  • X轴上允许自定义时间尺度(分钟,小时,日,周)
  • 高亮时间显示(自定义颜色)
  • 自动处理当前事件
  • 可定制的事件(text,size,backgorund color, …)
  • 自定义字体和颜色

数据库连接:

  • DataSource DataSoruceID 属性支持
  • SqlDataSource
  • XmlDataSource
  • DataTable
  • DataSet
  • ArrayList
  • 等等

事件处理:

  • 任意时段的单击事件(可自动回发PostBack或手动JavaScript处理)
  • 日历的单击事件(可自动回发PostBack或手动JavaScript处理)

 

兼容性:

  • Internet Explorer 6
  • Internet Explorer 7
  • Firefox 2
  • Firefox 3
  • Opera 9
  • Safari 2
  • Safari 3
  • Google Chrome 1

背景资料

关于DayPilot计划的事件安排算法在DayPilot Calendar control中有介绍。

DayPilot日历可以检测到重叠的块,并正确显示它们。同一时间段的事件的宽度可以根据数量自动调整宽度。

 

DayPilot的计划安排使用相同的算法,但布局是不同的:

计划安排显示在X轴上。

事件框的高度是固定的。

通过增加行的高度来处理同一时间段的事件。

 

Minimum Setup Sample

<DayPilot:DayPilotScheduler

  ID="DayPilotScheduler1"

  runat="server"

  DataSourceID="SqlDataSource1"

  DataStartField="start"

  DataEndField="end"

  DataTextField="name"

  DataValueField="id"

  DataResourceField="resource"

  StartDate="2009-01-01"

  CellDuration="60"

  Days="1" >

    <Resources>

      <DayPilot:Resource Name="Room A" Value="A" />

      <DayPilot:Resource Name="Room B" Value="B" />

      <DayPilot:Resource Name="Room C" Value="C" />

    </Resources>

</DayPilot:DayPilotScheduler>

第一组属性定义数据绑定:

  • DataSourceID
  • DataStartField (starting DateTime)
  • DateEndField (ending DateTime)
  • DataTextField (event text)
  • DataValueField (event id)
  • DataResourceField (resource id)

DataResourceFileds是很重要的,它的值和资源ID相匹配(Resoure.Value)

 

第二组属性定义时间的范围

  • StartDate (first visible day)
  • Days (number of visible days)
  • CellDuration (cell duration in minutes)

最后需要定义资源(rows):

  • Resource.Name (row name)
  • Resource.Value (row ID)

Usage Examples

  

设置:

Days="1"

CellDuration="60"

 

开始日期可以在代码中设置:

DayPilotScheduler1.StartDate = DateTime.Today;

Weekly Scheduler

 

设置:

Days="7"

CellDuration="1440"

计算每周的第一天使用 Week.FirstDayOfWeek:

DayPilotScheduler1.StartDate = Week.FirstDayOfWeek(DateTime.Today, DayOfWeek.Monday);

Monthly Scheduler 

 

设置:

CellDuration="1440"

在这个例子中,需要手动设置Days属性:

DayPilotScheduler1.StartDate =

new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);

DayPilotScheduler1.Days =

DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month);

Free/Busy Visualisation

 

这种视图下不显示事件的名称。

设置:

DurationBarVisible="false"

EventBackColor="#4A71CE"

Timeline Visualisation

 

设置:

DurationBarVisible="false"

EventBackColor="#CA2A50"

 

作者的官方网站:

posted @ 2011-07-21 11:36  敏捷学院  阅读(528)  评论(0编辑  收藏  举报