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

Leave a Reply