RadScheduler 显示全天活动

发布于 2024-09-14 17:48:47 字数 109 浏览 3 评论 0原文

嘿,这是一个愚蠢的问题要问你。您需要做什么才能让约会在 Telerik 的 RadScheduler 中显示为全天活动?您如何告诉 RadScheduler 该特定记录是全天事件(与开始和结束日期有关)?

Hey, here is a stupid question for you. What do you have to do to get an appointment to displayed as an all day event in Telerik's RadScheduler? How do you tell the RadScheduler that this specific record is an all day event (something to do with start and end dates)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め可乐爱微笑 2024-09-21 17:48:47

一种方法如下:

在您的 aspx 文件中,将以下属性添加到 RadScheduler 标记中。

<Telerik:RadScheduler runat="server" id="rsCalendar" ShowAllDay="true"
DataStartField="StartDate" DataFndField="EndDate">
</Telerik:RadScheduler>

我尚未输入所需的所有属性。您可以填写这些内容。

然后在您的代码隐藏文件中,您的 StartDate 和 EndDate 相差 24 小时。请注意,由于开始日期和结束日期是日期时间字段,因此您可以在其中包含时间,因此它们之间存在 24 小时的差异。这将自动在日历中显示为全天事件。

我创建了一个新的 DataTable 并将其作为数据源提供给 RadScheduler。



    DataTable dt = new DataTable();

    //The columns added are similar to the attributes in the RadScheduler control
    dt.Columns.Add("StartDate", GetType(DateTime));
    dt.Columns.Add("EndDate", GetType(DateTime));

    //Assigning the StartDate And EndDate some values for each row
    //that I want in this table
    DataRow dRow = dt.NewRow();
    dRow("StartDate") = sDate;  //Arbitrary variable containing the date
    dRow("EndDate") = sDate.AddHours(24);
    dt.Rows.Add(dRow);

    //Now bind this data table to the RadScheduler
    rsCalendar.DataSource = dt.DefaultView;
    rsCalendar.Databind();

这就是需要做的全部事情。此外,对于日历中的每个约会或条目,都必须为数据表创建一个新行。

还有其他方法可以做到这一点,这就是其中之一。

One way to do it is as follows:

In your aspx file add the following attribute to the RadScheduler tag

<Telerik:RadScheduler runat="server" id="rsCalendar" ShowAllDay="true"
DataStartField="StartDate" DataFndField="EndDate">
</Telerik:RadScheduler>

I have not entered all the attributes that are required. You can fill those in.

Then in your code behind file have a difference of 24 hours in your StartDate and EndDate. Note that since start date and end date are datetime fields you can have time in it and hence have a difference of 24 hours in them. This will automatically appear as allday event in the calendar.

I created a new DataTable and provided that as a Data Source to the RadScheduler.



    DataTable dt = new DataTable();

    //The columns added are similar to the attributes in the RadScheduler control
    dt.Columns.Add("StartDate", GetType(DateTime));
    dt.Columns.Add("EndDate", GetType(DateTime));

    //Assigning the StartDate And EndDate some values for each row
    //that I want in this table
    DataRow dRow = dt.NewRow();
    dRow("StartDate") = sDate;  //Arbitrary variable containing the date
    dRow("EndDate") = sDate.AddHours(24);
    dt.Rows.Add(dRow);

    //Now bind this data table to the RadScheduler
    rsCalendar.DataSource = dt.DefaultView;
    rsCalendar.Databind();

That is all there is that needs to be done. Also for each appointment or entry in the calendar a new row has to be created for the DataTable.

There are other ways to do this and this is one of them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文