Can the control drag the parent TimeItem to a different row and have all its associated sub items move with it?
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).
< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
How can i get the Row-Number on gantt1_OnTimeItem_ChangeRow?
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.
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.
Actually you can do this in Gantt_ASP just the same way you would do it in windows forms:
In the pageLoad add this:
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…
You will need version 18.104.22.168 and above to get this to work smoothly
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.
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.