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

[Solved] More information needed on RadScheduler

2 Answers 197 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
sherley
Top achievements
Rank 1
sherley asked on 09 May 2008, 02:29 PM
My company uses Radcontrols and I'm working on a project related to RadScheduler. My task is explained below:
Notifications have to be sent to the people associated to the recurring event/appointment. My sql retrieves all information like Start date, End Date, RecurrenceRule, ...etc, Along with that it also retrieves all the users with their email id's to send reminders of the events to be held .
  Using  RadScheduler RadScheduler1 = new RadScheduler();

I could retrieve the first half of my information(Start date, End Date, RecurrenceRule, ...etc). Now using the following statements I tried to retrieve the extra information related to the user but I'm getting the count as 0.
   The code I used is as follows:

dtRecurrence is the datatable that stores the values returned from the following sql statement
SELECT ID , Subject, Start , [End] , RecurrenceRule , RecurrenceParentID, usrID , usrEmail  FROM tblEvents";
RadScheduler RadScheduler1 = new RadScheduler();
RadScheduler1.DataKeyField = "ID";
RadScheduler1.DataStartField =
"Start";
RadScheduler1.DataEndField =
"End";
RadScheduler1.DataSubjectField =
"Subject";
RadScheduler1.DataRecurrenceField =
"RecurrenceRule";
RadScheduler1.DataRecurrenceParentKeyField =
"RecurrenceParentID";
RadScheduler1.DataSource = dtRecurrence;

ResourceType

resourceType = new ResourceType("User");
resourceType.TextField =
"usrEmail";
resourceType.KeyField = "ID";
resourceType.ForeignKeyField = "usrID";
resourceType.DataSource = dtRecurrence;

RadScheduler1.ResourceTypes.Add(resourceType);
RadScheduler1.DataBind();

Now when i tried to output the values of the user, I got an error

foreach

(Appointment recurringapt in RadScheduler1.Appointments)
{
        Response.Write("Resource Text is : " + recurringapt.Resources[0].Text);

        Response.Write("Resource Text is : " + recurringapt.Resources[0].Key);

}

So I did a count on the Resources and it gave me a count of 0. So my question to you is: I'm doing something wrong here. If so do let me know the correct code to go about this

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 May 2008, 04:15 PM
Hello Sherley,

We recommend using a separate datasource for Resources. Although it is technically possible to use one datasource for both appointments and resources, this approach will require some extra coding. For your specific case, I suggest you use CustomAttributes instead of Resources. Here is a sample code snippet how to set and access CustomAttributes from code-behind:

protected void Page_Load(object sender, EventArgs e)  
{  
    if (!IsPostBack)  
    {  
        RadScheduler1.CustomAttributeNames = new string[] { "usrEmail" };  
        RadScheduler1.EnableCustomAttributeEditing = true;  
          
    }          

protected void RadScheduler1_AppointmentClick(object sender, SchedulerEventArgs e)  
{  
    Response.Write(e.Appointment.Attributes["usrEmail"]);  



Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
sherley
Top achievements
Rank 1
answered on 14 May 2008, 01:29 PM
Thank you for the immediate reply. Tried using the code in my work and it works great
Tags
Scheduler
Asked by
sherley
Top achievements
Rank 1
Answers by
Peter
Telerik team
sherley
Top achievements
Rank 1
Share this question
or