New to Telerik UI for WinForms? Start a free 30-day trial
Adding new items
Updated over 6 months ago
RadGanttView uses its data source to create a hierarchical data structure. To be able to do that the gantt view must be able to identify each item by a unique id. When new items are added in bound mode you are responsible for providing ids for the items which will be stored in the data source. This is needed so the gantt view can maintain the hierarchical structure of the items without any distortions. If you fail to provide an id you will get an exception.
Here is an example of how to provide ids using the ItemChildIdNeeded event. The event is fired every time a new item is created and is about to be added to the data source.
C#
int integerIdCounter = 100;
private void radGanttView1_ItemChildIdNeeded(object sender, GanttViewItemChildIdNeededEventArgs e)
{
e.ChildId = this.integerIdCounter++;
}