I need to handle the draw relation event to save the new created relation to database. What is the event i shall look for?
Thanks and Regards
Prolay
3 Answers, 1 is accepted
0
Miroslav Nedyalkov
Telerik team
answered on 27 Dec 2012, 09:33 AM
Hi Prolay,
There is no event raised when a relation is being created. To create a dependency from one task to another, the GanttView calls the AddDependency method of the IDependant interface. It already has an implementation in the GanttTask class, but if you are using custom tasks you should implement it yourself and put the dependency in the database when this method is called.
I have extended the GanttTask class like this GanttTaskNew : GanttTask
So can you provide some code on how this can be achieved as i have tried doing something like this in the GanttTaskNew class but this doesn't work.
public new IDependency AddDependency(IGanttTask fromTask, DependencyType type)
{
return base.AddDependency(fromTask, type);
}
Regards,
Prolay
0
Miroslav Nedyalkov
Telerik team
answered on 27 Dec 2012, 03:56 PM
Hi Prolay,
The suggested approach doesn't work if you are using the GanttTask class - it only works if you are creating a custom implementation of the interface. In the case you are using the default GanttTask class I would suggest you to cast the Dependencies property of the task to INotifyCollectionChanged and to hook to its CollectionChanged event - it will be fired when the Dependencies are changed (including if the user draws a relation with the mouse).