<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectTracker.aspx.cs" Inherits="WebSampleBrowser.Dashboard.ProjectTracker" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Essential Studio for ASP.NET  : Project Tracker</title>
    <meta charset="utf-8" />
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <link rel="shortcut icon" href='<%= Page.ResolveClientUrl("~/Content/images/favicon.ico")%>' />
    <link rel="stylesheet" href='<%= Page.ResolveClientUrl("~/Content/bootstrap.min.css")%>' />
    <link rel="stylesheet" href='<%= Page.ResolveClientUrl("~/Content/ejthemes/ej.widgets.core.min.css")%>' />
    <link rel="stylesheet" href='<%= Page.ResolveClientUrl("~/Content/ejthemes/gradient-lime/ej.theme.min.css")%>' />

    <!--[if lt IE 9]>
    <script src='<%= Page.ResolveClientUrl("~/Scripts/jquery-1.11.3.min.js")%>' type="text/javascript"></script>
    <![endif]-->
    <!--[if gte IE 9]><!-->
    <script src='<%= Page.ResolveClientUrl("~/Scripts/jquery-3.0.0.min.js")%>' type="text/javascript"></script>
    <!--<![endif]-->
    <script src='<%= Page.ResolveClientUrl("~/Scripts/jsrender.min.js")%>' type="text/javascript"></script>
    <script src='<%= Page.ResolveClientUrl("~/Scripts/ej.web.all.min.js")%>' type="text/javascript"></script>
    <script src='<%= Page.ResolveClientUrl("~/Scripts/properties.js")%>' type="text/javascript"></script>

    <style type="text/css">
        html, body {
            height: 100%;
            padding: 0px;
            margin: 0px;
        }        
            .e-ganttdialog .e-link {
                position: relative;
                top: 10px;
            }        
        #Gantt {
            position: absolute;
        }
    </style>
</head>
<body>

    <form runat="server" onsubmit="return false" style="overflow: hidden; padding: 0; margin: 0; height: 100%; width: 100%;">

        <ej:Gantt ID="Gantt" runat="server" AllowColumnResize="true" AllowSorting="true"
            TaskIdMapping="TaskID" TaskNameMapping="TaskName" StartDateMapping="StartDate"
            ProgressMapping="Progress" DurationMapping="Duration" EndDateMapping="EndDate"
            ChildMapping="SubTasks" EnableVirtualization="false" HighlightWeekends="true"
            ScheduleStartDate="02/01/2014" ScheduleEndDate="03/14/2014" AllowDragAndDrop="true" ShowColumnChooser="true" ShowColumnOptions="true"
            ResourceInfoMapping="ResourceID" ResourceNameMapping="ResourceName" ResourceIdMapping="ResourceID"
            PredecessorMapping="Predecessors" ShowResourceNames="true" ShowGridCellTooltip="true" TreeColumnIndex="1"
            IncludeWeekend="false" EnableResize="true" EnableContextMenu="true" NotesMapping="notes">
            <DragTooltip ShowTooltip="true" />
            <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,update,cancel,indent,outdent,expandAll,collapseAll,search"></ToolbarSettings>
            <EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" AllowIndent="true" EditMode="cellEditing"></EditSettings>
            <SizeSettings Width="100%" Height="100%" />
        </ej:Gantt>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    </form>

</body>

</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Syncfusion.JavaScript.Web;

namespace WebSampleBrowser.Dashboard
{
    public partial class ProjectTracker : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {          
           var resource = GanttDefaultData.ResourceDataContext.GetResourceData();
            var DataSource = GanttDefaultData.GetTaskData();
            this.Gantt.DataSource = DataSource;
            this.Gantt.DataBind();
            this.Gantt.Resources = resource;            
        }
    }

    public class GanttDefaultData
    {

       public class TaskDetails
        {
            public int TaskID { get; set; }
            public string TaskName { get; set; }
            public string StartDate { get; set; }
            public string EndDate { get; set; }
            public int Duration { get; set; }
            public string Progress { get; set; }
            public List<TaskDetails> SubTasks { get; set; }
            public List<object> ResourceID { get; set; }
            public string Predecessors { get; set; }
        }

        public static List<TaskDetails> GetTaskData()
        {
            List<TaskDetails> tasks = new List<TaskDetails>();

            tasks.Add(new TaskDetails()
            {
                TaskID = 1,
                TaskName = "Project Schedule",
                StartDate = "02/03/2014",
                EndDate = "03/07/2014"
            });

            tasks[0].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 2,
                TaskName = "Planning",
                StartDate = "02/03/2014",
                EndDate = "02/07/2014"
            });

            tasks[0].SubTasks[0].SubTasks = new List<TaskDetails>();


            tasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 3,
                TaskName = "Plan timeline",
                StartDate = "02/03/2014",
                EndDate = "02/07/2014",
                Duration = 5,
                Progress = "100",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 4,
                TaskName = "Plan budget",
                StartDate = "02/03/2014",
                EndDate = "02/07/2014",
                Duration = 5,
                Progress = "100",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 5,
                TaskName = "Allocate resources",
                StartDate = "02/03/2014",
                EndDate = "02/07/2014",
                Duration = 5,
                Progress = "100",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 6,
                TaskName = "Planning complete",
                StartDate = "02/07/2014",
                EndDate = "02/07/2014",
                Duration = 0,
                Predecessors = "3FS,4FS,5FS"
            });

            tasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 7,
                TaskName = "Design",
                StartDate = "02/10/2014",
                EndDate = "02/14/2014"
            });

            tasks[0].SubTasks[1].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[1].SubTasks.Add(new TaskDetails()
            {
                TaskID = 8,
                TaskName = "Software Specification",
                StartDate = "02/10/2014",
                EndDate = "02/12/2014",
                Duration = 3,
                Progress = "60",
                Predecessors = "6FS",
                ResourceID = new List<object>() { 2 }
            });
            tasks[0].SubTasks[1].SubTasks.Add(new TaskDetails()
            {
                TaskID = 9,
                TaskName = "Develop prototype",
                StartDate = "02/10/2014",
                EndDate = "02/12/2014",
                Duration = 3,
                Progress = "100",
                Predecessors = "6FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[1].SubTasks.Add(new TaskDetails()
            {
                TaskID = 10,
                TaskName = "Get approval from customer",
                StartDate = "02/13/2014",
                EndDate = "02/14/2014",
                Duration = 2,
                Progress = "100",
                Predecessors = "9FS",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[1].SubTasks.Add(new TaskDetails()
            {
                TaskID = 11,
                TaskName = "Design complete",
                StartDate = "02/14/2014",
                EndDate = "02/14/2014",
                Duration = 0,
                Predecessors = "10FS"
            });


            tasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 12,
                TaskName = "Implementation Phase",
                StartDate = "02/17/2014",
                EndDate = "02/27/2014"
            });

            tasks[0].SubTasks[2].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[2].SubTasks.Add(new TaskDetails()
            {
                TaskID = 13,
                TaskName = "Phase 1",
                StartDate = "02/17/2014",
                EndDate = "02/27/2014"
            });

            tasks[0].SubTasks[2].SubTasks[0].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 14,
                TaskName = "Implementation Module 1",
                StartDate = "02/17/2014",
                EndDate = "02/27/2014"
            });

            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks = new List<TaskDetails>();


            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 15,
                TaskName = "Development Task 1",
                StartDate = "02/17/2014",
                EndDate = "02/19/2014",
                Duration = 3,
                Progress = "50",
                Predecessors = "11FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 16,
                TaskName = "Development Task 2",
                StartDate = "02/17/2014",
                EndDate = "02/19/2014",
                Duration = 3,
                Progress = "50",
                Predecessors = "11FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 17,
                TaskName = "Testing",
                StartDate = "02/20/2014",
                EndDate = "02/21/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "15FS,16FS",
                ResourceID = new List<object>() { 4 }
            });
            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 18,
                TaskName = "Bug fix",
                StartDate = "02/24/2014",
                EndDate = "02/25/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "17FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 19,
                TaskName = "Customer review meeting",
                StartDate = "02/26/2014",
                EndDate = "02/27/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "18FS",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[2].SubTasks[0].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 20,
                TaskName = "Phase 1 complete",
                StartDate = "02/27/2014",
                EndDate = "02/27/2014",
                Duration = 0,
                Predecessors = "19FS"
            });

            tasks[0].SubTasks[2].SubTasks.Add(new TaskDetails()
            {
                TaskID = 21,
                TaskName = "Phase 2",
                StartDate = "02/17/2014",
                EndDate = "02/28/2014"
            });

            tasks[0].SubTasks[2].SubTasks[1].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[2].SubTasks[1].SubTasks.Add(new TaskDetails()
            {
                TaskID = 22,
                TaskName = "Implementation Module 2",
                StartDate = "02/17/2014",
                EndDate = "02/28/2014"
            });

            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 23,
                TaskName = "Development Task 1",
                StartDate = "02/17/2014",
                EndDate = "02/20/2014",
                Duration = 4,
                Progress = "50",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 24,
                TaskName = "Development Task 2",
                StartDate = "02/17/2014",
                EndDate = "02/20/2014",
                Duration = 4,
                Progress = "50",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 25,
                TaskName = "Testing",
                StartDate = "02/21/2014",
                EndDate = "02/24/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "23FS,24FS",
                ResourceID = new List<object>() { 4 }
            });
            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 26,
                TaskName = "Bug fix",
                StartDate = "02/25/2014",
                EndDate = "02/26/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "25FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 27,
                TaskName = "Customer review meeting",
                StartDate = "02/27/2014",
                EndDate = "02/28/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "26FS",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[2].SubTasks[1].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 28,
                TaskName = "Phase 2 complete",
                StartDate = "02/28/2014",
                EndDate = "02/28/2014",
                Duration = 0,
                Predecessors = "27FS"
            });

            tasks[0].SubTasks[2].SubTasks.Add(new TaskDetails()
            {
                TaskID = 29,
                TaskName = "Phase 3",
                StartDate = "02/17/2014",
                EndDate = "02/27/2014"
            });
            tasks[0].SubTasks[2].SubTasks[2].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[2].SubTasks[2].SubTasks.Add(new TaskDetails()
            {
                TaskID = 30,
                TaskName = "Implementation Module 3",
                StartDate = "02/17/2014",
                EndDate = "02/27/2014"
            });

            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks = new List<TaskDetails>();

            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 31,
                TaskName = "Development Task 1",
                StartDate = "02/17/2014",
                EndDate = "02/19/2014",
                Duration = 3,
                Progress = "50",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 32,
                TaskName = "Development Task 2",
                StartDate = "02/17/2014",
                EndDate = "02/19/2014",
                Duration = 3,
                Progress = "50",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 33,
                TaskName = "Testing",
                StartDate = "02/20/2014",
                EndDate = "02/21/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "31FS,32FS",
                ResourceID = new List<object>() { 4 }
            });
            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 34,
                TaskName = "Bug fix",
                StartDate = "02/24/2014",
                EndDate = "02/25/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "33FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 35,
                TaskName = "Customer review meeting",
                StartDate = "02/26/2014",
                EndDate = "02/27/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "34FS",
                ResourceID = new List<object>() { 1 }
            });
            tasks[0].SubTasks[2].SubTasks[2].SubTasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 36,
                TaskName = "Phase 3 complete",
                StartDate = "02/27/2014",
                EndDate = "02/27/2014",
                Duration = 0,
                Predecessors = "35FS"
            });

            tasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 37,
                TaskName = "Integration",
                StartDate = "03/03/2014",
                EndDate = "03/05/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "20FS,28FS,36FS",
                ResourceID = new List<object>() { 3 }
            });
            tasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 38,
                TaskName = "Final Testing",
                StartDate = "03/06/2014",
                EndDate = "03/07/2014",
                Duration = 2,
                Progress = "0",
                Predecessors = "37FS",
                ResourceID = new List<object>() { 4 }
            });
            tasks[0].SubTasks.Add(new TaskDetails()
            {
                TaskID = 39,
                TaskName = "Final Delivery",
                StartDate = "03/07/2014",
                EndDate = "03/07/2014",
                Duration = 0,
                Predecessors = "38FS"
            });

            return tasks;

        }


        public class ResourceDataContext
        {
            public class Resources
            {
                public int ResourceID { get; set; }
                public string ResourceName { get; set; }
            }

            public static List<Resources> GetResourceData()
            {
                List<Resources> resourceDetails = new List<Resources>();

                resourceDetails.Add(new Resources() { ResourceID = 1, ResourceName = "Project Manager" });
                resourceDetails.Add(new Resources() { ResourceID = 2, ResourceName = "Software Analyst" });
                resourceDetails.Add(new Resources() { ResourceID = 3, ResourceName = "Developer" });
                resourceDetails.Add(new Resources() { ResourceID = 4, ResourceName = "Testing Engineer" });

                return resourceDetails;
            }

        }
    }

    public class DefaultData
    {
        public string StartDate { get; set; }
        public string EndDate { get; set; }
        public int Id { get; set; }
        public string Name { get; set; }
        public int Duration { get; set; }
        public string PercentDone { get; set; }
        public List<object> ResourceID { get; set; }
        public List<DefaultData> Children { get; set; }
        public string Predescessor { get; set; }
    }
}