kamagra how much to take

How To Wire A SharePoint List To A Telerik RadScheduler

Wiring a List of SPListItems to a Telerik RadScheduler is pretty easy. The important thing to remember when working with a RadScheduler is that it expects a list of Appointment objects, how you hydrate an Appointment object is pretty much up to you. Were it gets kinda weird is when you have the collection, the RadScheduler.Provider expects a SchedulerProviderBase super class. Either way it’s not too bad.

So let’s assume I am building the RadScheduler object in something like CreateChildControls like so:

  1. RadScheduler theScheduler = new RadScheduler();
  2. theScheduler.TimelineView.UserSelectable = true;
  3. theScheduler.OverflowBehavior = OverflowBehavior.Expand;
  4. theScheduler.SelectedView = SchedulerViewType.MonthView;

In the above I am missing the RadScheduler.Provider property, so gotta populate that. In this example, I am converting the SPList to a dataset, but you could iterate the items and return the values accordingly taking into account type casting. So I end up in a dataset format with something like this:

  1. tempCollection.AddRange(from DataRow row in masterTable.Rows
  2. select new Appointment
  3. {
  4. Start = DateTime.Parse(row[startFieldName].ToString()), End = DateTime.Parse(row[endFieldName].ToString()), ID = Guid.NewGuid(), Subject = StripTagsRegex(row[subjectFieldName].ToString()), RecurrenceState = state
  5. });
  6. public static string StripTagsRegex(string source)
  7. {
  8. return Regex.Replace(source, "", string.Empty);
  9. }

You could easily just do the SPListItems:

  1. tempCollection.AddRange(from SPListItem row in list.Items
  2. select new Appointment
  3. {
  4. Start = DateTime.Parse(row[startFieldName].ToString()), End = DateTime.Parse(row[endFieldName].ToString()), ID = Guid.NewGuid(), Subject = StripTagsRegex(row[subjectFieldName].ToString()), RecurrenceState = state
  5. });

Once you have the collection of Appointments, you have to make the SchedulerProviderBase superclass. This looks like this:

  1. public class ListSchedulerProvider : SchedulerProviderBase
  2. {
  3. private readonly List _listItemCollection;
  4. public ListSchedulerProvider(List collection)
  5. {
  6. _listItemCollection = new List();
  7. _listItemCollection = collection;
  8. }
  9. public override IEnumerable GetAppointments(RadScheduler owner)
  10. {
  11. return _listItemCollection;
  12. }
  13. public override IDictionary<ResourceType, IEnumerable<Resource>> GetResources(ISchedulerInfo schedulerInfo)
  14. {
  15. return new Dictionary<ResourceType, IEnumerable<Resource>>();
  16. }
  17. }

Then coordinate this class with scheduler Provider property:

  1. RadScheduler.Provider = new ListSchedulerProvider(Your Typed Appointment Collection);
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>