我正在創建一個包含列表人員(「倡導者」)和特定日期會議的圖表,全部在一個視圖中。我從他們的RadControls for ASP.NET AJAX包中使用Telerik的RadScheduler控件(2011年第2季度)。Telerik Scheduler與asp.net - 在一個顯示器中顯示Everyones會議
我有倡導者和會議之間的M:M關係。因此,我的數據庫表名爲GRS_Advocate
,GRS_Meeting
和GRS_AdvocateToMeeting
。
我想要完成的是在X軸上的Y軸和時間(以一小時爲增量)的倡導者名單。 Telerik的網站上最接近的例子是我可以在這裏找到http://demos.telerik.com/aspnet-ajax/scheduler/examples/timelineview/defaultcs.aspx,這是我試圖模仿我的數據的那個。
這裏是我想的可視表示:
現在,這裏的東西我真的開始一個screengrab:
這兩個「重要會議「記錄是同一次會議,兩個不同的倡導者計劃參加。這次會議應該在兩個不同的行上顯示,每個倡導者計劃參加一次,如第一張圖所示。
如何從這裏到達那裏?我懷疑問題可能出在我在網格中的<ResourceTypes>
標記中。
這裏是我得到的代碼 - 我也會分享C#,雖然在這裏可能不那麼重要。
<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="TimelineView"
DayStartTime="09:00:00" DayEndTime="19:00:00" DataSourceID="EventsDataSource"
DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
OverflowBehavior="Expand"
Localization-HeaderMultiDay="Work Week" OnNavigationComplete="RadScheduler1_NavigationComplete">
<AdvancedForm Modal="true" />
<ResourceTypes>
<telerik:ResourceType KeyField="Adv_AdvocateID" Name="Advocate" TextField="Adv_FullName" ForeignKeyField="Adv_AdvocateID"
DataSourceID="AdvocatesDataSource" />
</ResourceTypes>
<TimelineView UserSelectable="true" GroupBy="Adv_AdvocateID" GroupingDirection="Horizontal" />
<MultiDayView UserSelectable="true" />
<DayView UserSelectable="false" />
<WeekView UserSelectable="false" />
<MonthView UserSelectable="false" />
</telerik:RadScheduler>
</asp:Panel>
<asp:SqlDataSource ID="EventsDataSource" runat="server"
ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:GRSConnectionString %>"
SelectCommand="select m.[Id], m.[Room], m.[Start], m.[End], m.[Notes], m.[Subject], a.[Adv_AdvocateID], a.[Adv_FullName] from GRS_Meeting m join GRS_AdvocateToMeeting am on am.Meeting = m.Id join GRS_Advocate a on am.advocate = a.Adv_AdvocateID">
</asp:SqlDataSource>
<asp:SqlDataSource ID="AdvocatesDataSource" runat="server"
ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:GRSConnectionString %>"
SelectCommand="SELECT [Adv_AdvocateID],[Adv_FullName] FROM [GRS_Advocate]">
</asp:SqlDataSource>
和C#代碼,如果你有興趣:
private void Page_Load(object sender, EventArgs e)
{
if (RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
{
RadScheduler1.TimelineView.SlotDuration = TimeSpan.Parse(DurationList.SelectedValue);
RadScheduler1.TimelineView.TimeLabelSpan = int.Parse(TimeLabelSpan.SelectedValue);
RadScheduler1.TimelineView.ColumnHeaderDateFormat = ColumnHeaderDateFormat.SelectedValue;
RadScheduler1.TimelineView.NumberOfSlots = int.Parse(NumberOfSlotsList.SelectedValue);
RadScheduler1.TimelineView.GroupingDirection = (GroupingDirection)Enum.Parse(typeof(GroupingDirection), GroupingDirection.SelectedValue);
}
else if (RadScheduler1.SelectedView == SchedulerViewType.MultiDayView)
{
RadScheduler1.MultiDayView.NumberOfDays = int.Parse(NumberOfDaysList.SelectedValue);
RadScheduler1.FirstDayOfWeek = (DayOfWeek)int.Parse(FirstDayOfWorkWeekList.SelectedValue);
RadScheduler1.SelectedDate = RadScheduler1.SelectedDate.AddDays((int)RadScheduler1.FirstDayOfWeek - (int)RadScheduler1.SelectedDate.DayOfWeek);
}
}
protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
{
if (RadScheduler1.SelectedView == SchedulerViewType.MultiDayView)
{
RadScheduler1.MultiDayView.NumberOfDays = int.Parse(NumberOfDaysList.SelectedValue);
RadScheduler1.FirstDayOfWeek = (DayOfWeek)int.Parse(FirstDayOfWorkWeekList.SelectedValue);
//SelectedDate adjustment to make a Work Week view from Multi-day view
int WorkWeekAdjustmentTimeShift = (int)RadScheduler1.FirstDayOfWeek - (int)RadScheduler1.SelectedDate.DayOfWeek;
if (e.Command == SchedulerNavigationCommand.NavigateToNextPeriod)
{
if (WorkWeekAdjustmentTimeShift < 0)
WorkWeekAdjustmentTimeShift += 7;
}
else if (e.Command == SchedulerNavigationCommand.NavigateToPreviousPeriod)
{
if (WorkWeekAdjustmentTimeShift > 0)
WorkWeekAdjustmentTimeShift -= 7;
}
RadScheduler1.SelectedDate = RadScheduler1.SelectedDate.AddDays(WorkWeekAdjustmentTimeShift);
}
}
我一直在做這個,而現在,我只是不能讓過去這一點。任何幫助將不勝感激。
UPDATE
在會上指出,以上圖片是在日視圖的意見,我應該使用時間軸。那是對的;然而,當我查看時間線視圖時,我的支持者未列出。事實上,也不過是在時間軸上的x軸沒有Y軸可言,也沒有網格顯示:
您顯示的截圖是日視圖。如果你想讓它看起來像你的模擬,你不應該查看時間表視圖嗎?我引用了你鏈接的例子,它看起來與你正在尋找的東西相似,但似乎並沒有參考「日視圖」。 – KreepN
此外,在您的代碼行上: 。您會將分組方向更改爲「垂直」。 –
KreepN
謝謝KreepN。我已經在上面澄清了,並且我也將GroupingDirection固定爲Vertical。請參閱 – splatto