10175 : How can I insert Sub-nodes when using the gantt control in data-bound mode?

Question

How can I  insert Sub-nodes when using the gantt control in data-bound mode?

Answer

If the subnodes should be databound as well you can do it like this:

  private void gantt1_OnNodeInserted(PlexityHide.GTP.Grid aGrid, PlexityHide.GTP.NodeEventArgs e)
  {
  
   object row=e.GridNode.ListItemWhenDataBound();
   object val=e.GridNode.OwningCollection.NodeDataConnect.CurrencyManager.GetItemProperties().Find(“id”,true).GetValue(row);

   // Set up tree using DataViews, in this sample we only allow for SubLevel zero (root nodes) to have sub nodes
   if (e.GridNode.SubLevel==0)
   {
    DataView subNodeView = new DataView(dataSet21.project);
    if (val is Int32)
     subNodeView.RowFilter=”ownedby=”+val.ToString();
    else
     subNodeView.RowFilter=”ownedby=-1″;
     // Set the SubNodes to bind to the subNodeView
    e.GridNode.SubNodes_DataSourceList=subNodeView;
   }
  }

Leave a Reply