10519 : How can I limit scaling in Gantt_ASP?

Question

How can I limit scaling in Gantt_ASP?

Answer

To limit scaling etc in Gantt_ASP you can change the values of the datescaler in the postbacks… Like this sample that limits the shown span to 100 days

   protected void Gantt_ASP1_Load(object sender, System.EventArgs e)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    {

 

 

      if (!this.IsPostBack) // If this is not a postback then we init the datetime to Today + 15 days

      {

        Gantt_ASP1.StartTime = DateTime.Today;

        Gantt_ASP1.StopTime = DateTime.Today.AddDays(15);

      }

      else

      {

        // Limit the zooming to max 100 days

        if (Gantt_ASP1.StopTime.Subtract(Gantt_ASP1.StartTime) > new TimeSpan(100, 0, 0, 0, 0))

        {

          Gantt_ASP1.StopTime = Gantt_ASP1.StartTime.AddDays(100);

       

        }

 

      }

 

Leave a Reply