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

Saving and Loading Resources In SharePoint List

7 Answers 62 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 08 Jun 2014, 02:55 PM
Team,

I have implemented a radscheduler in a custom webpart. The data is stored in a SharePoint list. I get all of the fields to work and store data correctly with the example that used the LoadSchedulerData event. However, this example does not show how to properly load and save the resources from/to the SharePoint list. I have a text field called Resource added to the list. What method or format do I need to use to properly save and load the resources? Below is the event that loads the data:

​private void LoadSchedulerData()
{
try
{
SPWeb web = SPContext.Current.Web;
var list = web.Lists[strAppointmentsList];
Scheduler.DataSource = list.Items.GetDataTable();
Scheduler.DataSubjectField = "Title";
Scheduler.DataStartField = "Start";
Scheduler.DataEndField = "End";
Scheduler.DataKeyField = "ID";
Scheduler.DataRecurrenceField = "RecurrenceRule";
Scheduler.DataRecurrenceParentKeyField = "RecurrenceParentID";
Scheduler.DataDescriptionField = "Description";
Scheduler.DataReminderField = "Reminder";
Scheduler.DataBind();
}
catch (Exception ex)
{
lblError.Text = String.Format("Data Loading Error: {0}, {1}", ex.Message.ToString(), ex.StackTrace.ToString());
}
}


I notice there is no "DataResourceField" like there is a "DataReminderField" so I can't assign the resource field in this manner.

(Note: I am using the trial version until we get the full version license which should be soon!)

Regards

Dan Walker

7 Answers, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 08 Jun 2014, 06:55 PM
Also, I would like to know how to do the same thing with Reminders. I see how this is stored in the list, but this format is harder to read out as a string if I change to creating appointments in the code instead of just using DataBind.

Thanks!
0
Dan
Top achievements
Rank 1
answered on 09 Jun 2014, 01:50 PM
Okay,

I decided to write a custom provider and this is mostly working. I can insert appointments! However, I can not see them on the calendar at all. I am sure there is an order of operations problem.

Here is the code in the user control:

<asp:Panel ID="pnlCalendar" runat="server">
<asp:Panel runat="server" ID="RadButtonPane"></asp:Panel>
<telerik:RadScheduler ID="Scheduler" runat="server" OnNavigationCommand="Scheduler_NavigationCommand" AdvancedForm-Modal="true" StartInsertingInAdvancedForm="True" StartEditingInAdvancedForm="true">
<ExportSettings>
<Pdf PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in" PageTopMargin="1in" />
</ExportSettings>
<AdvancedForm Modal="true"></AdvancedForm>
<TimelineView HeaderDateFormat="MM/dd/yyyy" />
<TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
<AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
<Reminders Enabled="true"></Reminders>
</telerik:RadScheduler>
</asp:Panel>

The code behind that I think should work:

public partial class CNRFC_TSWP_WP_UserControl : UserControl
{
protected RadScheduler Scheduler;
public string strAppointmentsList = "Appointments";
public string strResourcesList = "Resources";
public string fldCategories;
//private List<Category> lstCategories;
protected Panel pnlCalendar;
protected Panel pnlError;
protected Label lblError;
protected Panel RadButtonPane;
protected RadButton btnRadButton;
protected RadButtonToggleState tsRadButtonToggleState;
public SPList AppointmentsList;
public SPList ResourcesList;
public CNRFC_TSWP_WP parentWebpart;

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
parentWebpart = this.Parent as CNRFC_TSWP_WP;
SPWeb web = SPContext.Current.Web;
AppointmentsList = web.Lists[strAppointmentsList];
ResourcesList = web.Lists[strResourcesList];
DateTime baseDate = DateTime.Today;
DateTime thisMonthStart = baseDate.AddDays(1 - baseDate.Day);
Scheduler.Provider = new SharePointSchedulerProvider();
SetupCalendar(thisMonthStart);
}

protected void Page_Load(object sender, EventArgs e)
{

}

protected override void CreateChildControls()
{

}
.....

The OnInit function runs with no errors and there is no errors on the page, just no events!
0
Plamen
Telerik team
answered on 10 Jun 2014, 11:50 AM
Hi Dan,

In such scenario when RadScheduler have to be bound in the code behind we kindly recommend using the code similar to the one in this on-line demo.

I am also attaching a sample web part where similar behavior is implemented.

Hope this will be helpful.


Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dan
Top achievements
Rank 1
answered on 11 Jun 2014, 01:55 AM
Actually I got this working really well by writing a custom provider that uses a SharePoint list for the appointments and another one for the resource types. I even created a custom form for the resource list so that you can choose a color and background style. The results are nice but just one thing I would like to do. In the attached screen capture I want to align the secondary groups (CNR, CNRFC) into their own row still inside the main group (Senior Leaders). There are going to be more secondary and main groups. Basically in this image I want all the red events in 1 row and green in another and will add more.

Regards,

Dan
0
Plamen
Telerik team
answered on 11 Jun 2014, 08:29 AM
Hello Dan,

You can use the GroupBy property and group RadScheduler by the resource as for example it is done in this on-line demo when you set vertical direction.

Hope this information will be helpful.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dan
Top achievements
Rank 1
answered on 11 Jun 2014, 08:55 AM
Yes, I am using grouping as I thought the picture showed. Apparently grouping by 2 resources is not yet supported. So is there another way possible to move the secondary groups to their own row by css. I want the red ones on one line and the green ones on another. These are inside the group on the left. If this is not possible this way, I could switch my grouping, but then I want the height of the actual rows to be smaller for each group and the RowHeight property does not do that, it just changes the heights of the events. I want the entire row to be smaller in height. I could then find some way of using jQuery to wrap the group headers the way I want.

Thanks!
0
Plamen
Telerik team
answered on 11 Jun 2014, 11:31 AM
Hi Dan,

Thank you for getting back to us.

Unfortunately such scenario with grouping by more than one resource is not supported by RadScheduler. Please excuse us for this limitation of our control.

Hope this will explain the issue. If you have further questions please don't hesitate to contact us again.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or