2010-08-16 44 views
0

嘿,這是一個愚蠢的問題給你。您需要做什麼才能將預約顯示爲Telerik的RadScheduler中的全天事件?你如何告訴RadScheduler該特定記錄是一個全天事件(與開始和結束日期有關)?RadScheduler顯示全天事件

回答

3

一種方式做到這一點如下:

在你的aspx文件下列屬性添加到R​​adScheduler標籤

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

我還沒有輸入所有需要的屬性。你可以填寫那些。

然後在你的代碼背後的文件有24小時的差異在你的StartDate和EndDate。請注意,由於開始日期和結束日期都是日期時間字段,因此您可以在其中有時間,因此它們之間的差異爲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(); 

這就是所有需要做的事情。對於日曆中的每個約會或條目,還必須爲DataTable創建一個新行。

還有其他方法可以做到這一點,這就是其中之一。