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

How to link Tasks to Appointments

4 Answers 65 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 21 May 2008, 05:33 AM

It seems that I cannot find the answer to what I need to do with the Scheduler in the documentation and online, but I would imagine it’s been done many times. We keep a list of tasks for each user and we want to associate the tasks with appointments (sometimes). I have a table of Tasks with the PK being TaskID type Int. I also have an Appointment table with one of the fields called TaskID so it can have the ability to link back to the Tasks; its type is also Int. I don’t want to use the resources and show the users the tasks to select from , instead they will select that from a grid outside the scheduler. The idea now is to intercept the Insert operation and add the TaskID to the appointment. How do I do that? (by the way, I use Object Datasource and VB)

 Thanks for all the help.

-Sam

4 Answers, 1 is accepted

Sort by
0
Sam
Top achievements
Rank 1
answered on 22 May 2008, 03:52 PM
Any help.
0
T. Tsonev
Telerik team
answered on 23 May 2008, 12:12 PM
Hi Sam,

Please, excuse us for the late response. You can add the TaskID value as a custom attribute in the Insert event:

protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e) 
    e.Appointment.Attributes["TaskID"] = "1"; 

This way the value should be accessible in your data source. I am not sure if the type mismatch will be a problem (custom attributes are always strings). Give it a try and let us know if it works.

All the best,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sam
Top achievements
Rank 1
answered on 23 May 2008, 04:02 PM
Thanks for the reply. I already tried this solution and it did not work because of the type mismatch. Is there a different way to have access to the fields/attributes of the object in a raw formate, ie. without using the Appointment.Attributes. This way I can set the TaskID for the appointment at insert?

thanks,
-Sam
0
Dimitar Milushev
Telerik team
answered on 26 May 2008, 04:54 PM
Hello Sam,

I think in this case it would be best to use Appointment Resources. If you don't define any ResourceTypes in the Scheduler, the Resources won't be editable through the Advanced Form, but you can still add them through code-behind when Inserting/Updating as long as your DataSource is set properly. For example the following will insert 1 in the TaskID column:

    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e) 
    { 
        e.Appointment.Resources.Add(new Resource("TaskID", 1, "")); 
    } 


Best wishes,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Sam
Top achievements
Rank 1
Answers by
Sam
Top achievements
Rank 1
T. Tsonev
Telerik team
Dimitar Milushev
Telerik team
Share this question
or