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 22.214.171.124 and above to get this to work smoothly
I am using GTP.NET
How can I stop droping a TimeItem when user drags the TimeItem into a Time item area which is designated as a holiday or non-working area.
I have used “OnTimeItemAreaScalerPaintBackground” event to paint holidays and non-working days in different colour. I do not want users to drag the time items into those areas.
You probably do not want to stop the drag over since it would irritate the user, but you can send visual feedback when the user is over a forbidden area. You can do this by changing the TimeItemLayout of the moving time item in the OnTimeItem_Hoover event: “Fired while mouse is moved and possibly over a time item. This is a good place to set e.Allow false if you do not want to allow the ongoing operation. You can also limit dragging in this event by e.x=gantt1.MouseDownPoint.X; will stop move in x direction ”
When the user actually drop the time item you can check that it is ok in the OnTimeItem_Move event. If it is not ok just set e.Allow=false and it will jump back.