RADScheduler in SharePoint list (as datasource)

2 posts, 1 answers
  1. Aroh Shukla
    Aroh Shukla avatar
    7 posts
    Member since:
    Oct 2008

    Posted 21 Nov 2008 Link to this post

    Hi Admin,

    I have used a RADScheduler in SharePoint list as datasource (members in SharePoint group) and very similar to example in http://demos.telerik.com/ASPNET/Prometheus/Scheduler/Examples/Resources/DefaultCS.aspx

    I used web part (NOT user control or SmartPart, but VS.NET 2008 IDE) and this the code:


    namespace RADSchedulerWP    
    2 {    
    3     [Guid("ebb5c169-13bf-488e-a8dc-299f39eabb9b")]    
    4     public class RADSchedulerWP : System.Web.UI.WebControls.WebParts.WebPart    
    5     {    
    6         public RADSchedulerWP()    
    7         {    
    8         }    
    9    
    10         private DropDownList allUsers;    
    11         private RadScheduler theScheduler = null;    
    12    
    13         protected override void OnInit(EventArgs e)    
    14         {    
    15             base.OnInit(e);    
    16    
    17             // Check for all USERS (Memeber)the in SharePoint Grp.    
    18             SPWeb web = SPControl.GetContextWeb(Context);    
    19             allUsers = new DropDownList();    
    20    
    21             allUsers.Items.Insert(0, new ListItem("Please select...""0"));    
    22    
    23             foreach (SPUser user in web.AllUsers)    
    24             {    
    25                 allUsers.Items.Add(user.Name);    
    26             }    
    27    
    28             this.Controls.Add(this.allUsers);    
    29    
    30             // Create the table that will hold the toolbar and the calendar    
    31             HtmlTable theMainTable = new HtmlTable();    
    32             theMainTable.Width = "100%";    
    33             theMainTable.CellPadding = 0;    
    34             theMainTable.CellSpacing = 0;    
    35             theMainTable.Border = 0;    
    36             this.Controls.Add(theMainTable);    
    37    
    38             // Create the row and the cell for the calendar    
    39             HtmlTableRow calendarRow = new HtmlTableRow();    
    40             theMainTable.Rows.Add(calendarRow);    
    41             HtmlTableCell calendarCell = new HtmlTableCell();    
    42             calendarRow.Cells.Add(calendarCell);    
    43    
    44             CheckScriptManager();    
    45    
    46             theScheduler = new RadScheduler();    
    47             theScheduler.Skin = "Office2007";    
    48             // Disable the timeline view    
    49             theScheduler.TimelineView.UserSelectable = false;    
    50             theScheduler.Width = new Unit(800, UnitType.Pixel);    
    51             theScheduler.Height = new Unit(600, UnitType.Pixel);    
    52             theScheduler.OverflowBehavior = OverflowBehavior.Expand;    
    53             theScheduler.Provider = new ListSchedulerProvider();    
    54             theScheduler.SelectedView = SchedulerViewType.WeekView;    
    55    
    56             // The following line plus the CSS classes added in the Default.aspx    
    57             // caused the appointments to cross the boundary of the month cell    
    58             theScheduler.MonthView.VisibleAppointmentsPerDay = 5;    
    59             //theScheduler.ShowAdvancedEditForm = true;    
    60    
    61             this.Controls.Add(theScheduler);    
    62       
    63    
    64         }    
    65    
    66         private ScriptManager CheckScriptManager()    
    67         {    
    68             ScriptManager sm = ScriptManager.GetCurrent(Page);    
    69             if (sm == null)    
    70             {    
    71                 if (Page.Form != null)    
    72                 {    
    73                     sm = new ScriptManager();    
    74                     sm.ID = Page.Form.ID + "_ScriptManager";    
    75                     Page.Form.Controls.Add(sm);    
    76                 }    
    77             }    
    78    
    79             return sm;    
    80         }    
    81    
    82         protected override void CreateChildControls()    
    83         {    
    84             base.CreateChildControls();    
    85    
    86             // TODO: add custom rendering code here.    
    87             Label label = new Label();    
    88             label.Text = "Demo RADScheduler!";    
    89             this.Controls.Add(label);    
    90    
    91         }    
    92    
    93         public class ListSchedulerProvider : SchedulerProviderBase    
    94         {    
    95             public override void Delete(RadScheduler owner, Appointment appointmentToDelete)    
    96             {    
    97    
    98             }    
    99    
    100             public override System.Collections.Generic.IEnumerable<Appointment> GetAppointments(RadScheduler owner)    
    101             {    
    102                 List<Appointment> appointmentsList = new List<Appointment>();    
    103    
    104                 Appointment newAppt = new Appointment();    
    105                 newAppt.Start = new DateTime(2008, 7, 14, 0, 0, 0);    
    106                 newAppt.End = newAppt.Start.AddDays(1);    
    107                 newAppt.ID = Guid.NewGuid();    
    108                 newAppt.Subject = "All Day 1";    
    109                 newAppt.ToolTip = "All Day 1";    
    110                 newAppt.RecurrenceState = RecurrenceState.NotRecurring;    
    111                 appointmentsList.Add(newAppt);    
    112    
    113                 newAppt = new Appointment();    
    114                 newAppt.Start = new DateTime(2008, 7, 14, 0, 0, 0);    
    115                 newAppt.End = newAppt.Start.AddDays(1);    
    116                 newAppt.ID = Guid.NewGuid();    
    117                 newAppt.Subject = "All Day 2";    
    118                 newAppt.ToolTip = "All Day 2";    
    119                 newAppt.RecurrenceState = RecurrenceState.NotRecurring;    
    120                 appointmentsList.Add(newAppt);    
    121    
    122                 newAppt = new Appointment();    
    123                 newAppt.Start = new DateTime(2008, 7, 14, 0, 0, 0);    
    124                 newAppt.End = newAppt.Start.AddDays(1);    
    125                 newAppt.ID = Guid.NewGuid();    
    126                 newAppt.Subject = "All Day 3";    
    127                 newAppt.ToolTip = "All Day 3";    
    128                 newAppt.RecurrenceState = RecurrenceState.NotRecurring;    
    129                 appointmentsList.Add(newAppt);    
    130    
    131                 return appointmentsList;    
    132             }    
    133    
    134             public override System.Collections.Generic.IEnumerable<ResourceType> GetResourceTypes(RadScheduler owner)    
    135             {    
    136                 return null;    
    137             }    
    138    
    139             public override System.Collections.Generic.IEnumerable<Resource> GetResourcesByType(RadScheduler owner, string resourceType)    
    140             {    
    141                 return null;    
    142             }    
    143    
    144             public override void Insert(RadScheduler owner, Appointment appointmentToInsert)    
    145             {    
    146    
    147             }    
    148    
    149             public override void Update(RadScheduler owner, Appointment appointmentToUpdate)    
    150             {    
    151    
    152             }    
    153         }    
    154     }    
    155 }    
    156    



    Now I have couple of questions:

    1) I need to attach my dropdownlist (SharePoint DataSource) to scheduler with excatly same result as the example aforementioned. (http://demos.telerik.com/ASPNET/Prometheus/Scheduler/Examples/Resources/DefaultCS.aspx, Defining resources). For e.g. If in dropdownlist my name is selected then only my appointment / event is selected without refresh. I guess its done through AJAX.

    2) In the EditForm, under "More details", instead of Room, I have to have a event category

    like Business trip, Vacation, sick leave with proper color code.
    For e.g. for business trip - color could be blue, vacation - could could be pink.

    Could you please advice on this and how can i achieve this?
    Web Part code would be very helpful.

    Thanks.

    Cheers,
    Aroh
  2. Answer
    Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 25 Nov 2008 Link to this post

    Hello Aroh Shukla,

    Please review my answer to your other post - http://www.telerik.com/community/forums/aspnet-ajax/scheduler/radscheduler-in-sharepoint-list.aspx

    Kind regards,
    Dimitar Milushev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Back to Top