11108 : Can the control drag the parent TimeItem to a different row and have all its associated sub items move with it?

Question

Can the control drag the parent TimeItem to a different row and have all its associated sub items move with it?

Answer

There is no property to set to do this automatically; you will need to react to an event and move child time items according to your rules.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

In GTP.NET I would suggest to implement OnTimeItem_ChangeRow and in this event track down the child nodes by e.TimeItem.GanttRow.GridNode.SubNodes[0..x] and for each SubNode y do Gantt.GanttRowFromGridNode(y) then loop over the layers and timeItems and move them the way you need (or move the whole GridNode to a new parent if that is what you want).

 

10834 : How can i get the Row-Number on gantt1_OnTimeItem_ChangeRow?

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />Question

How can i get the Row-Number on gantt1_OnTimeItem_ChangeRow?

 

Answer

For the old row you follow e.TimeItem.GanttRow.GridNode.Index

For the new row you follow e.NewGanttRow.GridNode.Index

Mind you that the Index is the Index of the list of GridNodes (Grid.OwningCollection), if this node is a sub node you will get the index of the position within that child list.

10904 : I want to allow a user to move a timeitem between rows, but not to change the time

Question

I’m using the gantt control with ASP.NET. I want to allow a user to move a timeitem between rows, but not to change the time – just move it to another row at the same time as it was before being moved.  Is there a way to do this?

I think if the OnClientSideChangesApplied event returned a TimeItemEventsArg instead of just a plain event, it would be more helpful.

Answer

Actually you can do this in Gantt_ASP just the same way you would do it in windows forms:

In the pageLoad add this:

Gantt_ASP1.Gantt.OnTimeItem_Move +=

new TimeItemEvent(Gantt_OnTimeItem_Move);

and then implement the event like this:

  void Gantt_OnTimeItem_Move(Gantt aGantt, TimeItemEventArgs e)
  {
    if (e.NewGanttRow!=null && e.NewGanttRow!=e.TimeItem.GanttRow)
    {
      // The user wants to switch rows…
      //Ok, but lets zero the time move…
      e.Diff=TimeSpan.Zero;
    }
  }

You will need version 3.0.5.17 and above to get this to work smoothly

10638 : Is it possible to restrict the movement of a timeitem to specific rows?

Question

Is it possible to restrict the movement of a timeitem to specific rows? E.g. If I have a timeitem placed in row 1 and I have a total of 6 rows, but I will only allow the timeitem to be repositioned at row 2 and 3.

Answer

Sure! What you do is to implement the OnTimeItem_ChangeRow event and check if the e.NewGanttRow is one of your illegal rows. If so set e.Allow=false. Done.