This is a migrated thread and some comments may be shown as answers.

WeekView - can I do this?

5 Answers 171 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 15 Aug 2008, 12:14 PM
Instead of having the time listed in the column on the left I want to add names of employees. This view would be locked.

Unfortunately, I can't upload screenshots to the forum, so could you provide we me an email address I could send the image to as an example of what I want?

5 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 15 Aug 2008, 02:46 PM
Hi Steve,

You can hide the 'Hours' column and group by User horizontally to achieve the desired effect.

Sincerely yours,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Steve
Top achievements
Rank 1
answered on 15 Aug 2008, 04:13 PM
Thanks Simon

Currently the Scheduler datasource is a SharePoint List with an SPUser Field in the List. I have a dropdownlist above the scheduler with all members of a certain role. When the selected item is changed in the dropdownlist I rebind the scheduler based on the single user value.

For this next part I have a 'Show All' item in the dropdownlist, which is why I want to Group them as you suggest.

Does this mean I need to dynamically add a ResourceType and give it a ForeignKeyField so it matches the SPUser field in the main datasource?

                    ResourceType rt = new ResourceType();  
                    rt.DataSource = dtUsers;  
                    rt.TextField = "Author";  
                    rt.KeyField = "ID";  
                    rt.ForeignKeyField = "Author";  
                    RadScheduler1.ResourceTypes.Add(rt);  
                    RadScheduler1.GroupBy = "Author";  
                    RadScheduler1.GroupingDirection = GroupingDirection.Horizontal;  
 

Can you let me know if this is the correct method, or am I going in the wrong direction?

cheers,
Steve
0
Steve
Top achievements
Rank 1
answered on 18 Aug 2008, 10:29 AM
Simon -

I can't seem to get this working. Here's what I have so far within a SharePoint webpart:

            Select an alternative Calendar:&nbsp;<asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="ddlMembers_SelectedIndexChanged" ID="ddlMembers" runat="server"></asp:DropDownList> 
            <asp:Label ForeColor="Red" ID="lblCalendarOwner" runat="server"></asp:Label> 
            <asp:HiddenField ID="hdnSelectedCal" runat="server" /> 
 

            <telerik:RadScheduler runat="server" ID="RadScheduler1" 
            Width="750px" Height="550px" Skin="Default" 
            DayStartTime="08:00:00" DayEndTime="17:00:00"                    
            DataSourceID="spdsCalendar" DataKeyField="ID" DataSubjectField="Location" 
            DataStartField="MovementFromDate" DataEndField="MovementToDate" 
            SelectedView="WeekView" ShowAllDayRow="false" DayView-UserSelectable="false" TimelineView-UserSelectable="false" 
            DisplayDeleteConfirmation="true" StartInsertingInAdvancedForm="true" 
            OnAppointmentDataBound="RadScheduler1_AppointmentDataBound">  
            <AppointmentTemplate> 
                <%# Eval("Subject")%> 
            </AppointmentTemplate> 
            </telerik:RadScheduler> 
            <sharepoint:SPDataSource DataSourceMode="List" 
                Scope="Default" UseInternalName="true"   
                IncludeHidden="true"   
                ID="spdsCalendar" runat="server">  
                <SelectParameters> 
                    <asp:Parameter Name="ListName" DefaultValue="TravelCalendarList" /> 
                </SelectParameters> 
                <InsertParameters> 
                    <asp:Parameter Name="ListName" DefaultValue="TravelCalendarList" /> 
                </InsertParameters> 
                <UpdateParameters> 
                    <asp:Parameter Name="ListName" DefaultValue="TravelCalendarList" /> 
                </UpdateParameters> 
                <DeleteParameters> 
                    <asp:Parameter Name="ListName" DefaultValue="TravelCalendarList" /> 
                </DeleteParameters> 
            </sharepoint:SPDataSource> 

        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!this.IsPostBack)  
            {  
                loadGroupMembers();  
                lblCalendarOwner.Text = "Current Calendar: " + SPContext.Current.Web.CurrentUser.Name;  
                hdnSelectedCal.Value = SPContext.Current.Web.CurrentUser.Name;  
                RadScheduler1.SelectedDate = DateTime.Now;  
            }  
            spdsCalendar.SelectCommand = getQueryString();  
        }  
 

The call to loadGroupMembers simply populates the ddlMembers dropdownlist with all members of a given SharePoint role, and inject a 'Show All' list item.

        protected void ddlMembers_SelectedIndexChanged(object sender, EventArgs e)  
        {  
            if (ddlMembers.SelectedItem.Value != "-1")  
            {  
                try 
                {  
                    if (ddlMembers.SelectedItem.Value == "0"// Show All  
                    {  
                        hdnSelectedCal.Value = "All";  
                        spdsCalendar.SelectCommand = getQueryString();  
                        lblCalendarOwner.Text = "Current Calendar: Show All";  
                        DataTable dt = buildUsersTable();  
                        if (null != dt)  
                        {  
                            ResourceType rt = new ResourceType("Author");  
                            rt.DataSource = dt;  
                            rt.TextField = "Author";  
                            rt.KeyField = "AuthorId";  
                            rt.ForeignKeyField = "AuthorId";  
                            RadScheduler1.ResourceTypes.Add(rt);  
                            RadScheduler1.GroupBy = "Author";  
                            RadScheduler1.GroupingDirection = GroupingDirection.Vertical;  
                            RadScheduler1.ShowHoursColumn = false;  
                            RadScheduler1.SelectedView = SchedulerViewType.TimelineView;  
                        }  
                    }  
                    else 
                    {  
                        RadScheduler1.SelectedView = SchedulerViewType.WeekView; // set the view  
                        lblCalendarOwner.Text = "Current Calendar: " + ddlMembers.SelectedItem.Text;  
                        hdnSelectedCal.Value = ddlMembers.SelectedItem.Text;  
                        spdsCalendar.SelectCommand = getQueryString();  
                    }  
                }  
                catch (Exception ex)  
                {  
                    lblError.Text = ex.Message.ToString();  
                }  
            }  
        } 

When the dropdownlist runs a postback, I check if the value is not "0" and then show the calendar items for the selected user. This is all working fine.

However, when 'Show All' is selected I build a DataTable with all of the Members and attempt to add a ResourceType.

Firstly, the members appear correctly on the left hand side where the ShowHoursColumn used to be. However, no Appointments appear.

Secondly, with 'Show All' selected in the dorpdownlist I change it back to an individual user and get a 'Failed to Load ViewState' error.

How do I switch from dynamically adding a ResourceType with a Timeline View back to the individual user's Appointments in a WeekView?

thanks,

Steve
0
Steve
Top achievements
Rank 1
answered on 18 Aug 2008, 01:27 PM
I have got rid of the ViewState error by adding EnableViewState="false" to the scheduler. Will this have any detrimental effects on the functionality of the scheduler?
0
Peter
Telerik team
answered on 18 Aug 2008, 04:05 PM
Hi Steve,

Setting  EnableViewState="false" is completely safe and will not set the ground for any errors in the future. The only drawback is that with a viewstate switched off, RadSchduler may perform slower. Let us know if you noticed any negative consequences in terms of performance.



Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
Steve
Top achievements
Rank 1
Answers by
Simon
Telerik team
Steve
Top achievements
Rank 1
Peter
Telerik team
Share this question
or