Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    Gantt / Resources
    <%@ Page Title="Gantt-Resource Allocation-ASP.NET-SYNCFUSION"   Language="C#" MetaDescription="This example illustrates assigning and managing resources for the tasks in project view in the Syncfusion Gantt chart control." AutoEventWireup="true" MasterPageFile="~/Samplebrowser.Master" CodeBehind="Resource.aspx.cs" Inherits="WebSampleBrowser.Gantt.Resource" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="SampleHeading" runat="server">
        <span class="sampleName">Gantt / Resources</span>
    </asp:Content>
    
    
    <asp:Content ID="ControlContent" runat="server" ContentPlaceHolderID="ControlsSection">
        <div>
            <ej:Gantt ID="GanttControlResource" runat="server" AllowColumnResize="true"
                TaskIdMapping="Id" TaskNameMapping="Name" StartDateMapping="StartDate" DurationMapping="Duration"
                ProgressMapping="PercentDone" ChildMapping="Children" PredecessorMapping="Predescessor"
                ResourceInfoMapping="Resources" ResourceNameMapping="Name" ResourceIdMapping="Id" Load="load"          
                AllowGanttChartEditing="true" TreeColumnIndex="0" SplitterPosition="54%" IsResponsive="true">
                 <EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" AllowIndent="true" EditMode="cellEditing" />
                <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,update,cancel,indent,outdent,expandAll,collapseAll" />
                <SizeSettings Width="100%" Height="450px" />
            </ej:Gantt>
        </div>
    </asp:Content>
    
    <asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ScriptSection">
        <script type="text/javascript">
            function load() {
                var ganttObject = $("#<%=GanttControlResource.ClientID%>").data("ejGantt"),
                    columns = ganttObject.getColumns();
                columns[1].visible = columns[2].visible = columns[5].visible = columns[6].visible = false;
                columns[7].visible = columns[8].visible = columns[9].visible = true;
                columns[3].width = columns[8].width = columns[9].width = 100;
                columns[0].width = columns[7].width = 100;
                columns[4].width = 85;
            }
        </script>
    </asp:Content>
    
    
    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.Gantt
    {
        public partial class Resource : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                var DataSource = this.GetDataSource();
                this.GanttControlResource.DataSource = DataSource;
                var resources = this.GetResourceCollection();
                this.GanttControlResource.Resources = resources;
                this.GanttControlResource.DataBind();
            }
    
            #region Create BusinessObject
            public class BusinessObject
            {
                public object StartDate { get; set; }
                public int Id { get; set; }
                public string Name { get; set; }
                public int Duration { get; set; }
                public int PercentDone { get; set; }
                public List<BusinessObject> Children { get; set; }
                public string Predescessor { get; set; }
                public string BaselineStartDate { get; set; }
                public string BaselineEndDate { get; set; }
                public List<int> Resources { get; set; }
            }
            #endregion
    
            #region Create ResourceObject
            public class ResourceObject
            {
                public int Id { get; set; }
                public string Name { get; set; }
            }
            #endregion
    
            #region Create Resource Collection
            private List<ResourceObject> GetResourceCollection()
            {
                List<ResourceObject> resourceCollection = new List<ResourceObject>();
    
                resourceCollection.Add(new ResourceObject() { Id = 1, Name = "Resource1" });
                resourceCollection.Add(new ResourceObject() { Id = 2, Name = "Resource2" });
                resourceCollection.Add(new ResourceObject() { Id = 3, Name = "Resource3" });
                resourceCollection.Add(new ResourceObject() { Id = 4, Name = "Resource4" });
                resourceCollection.Add(new ResourceObject() { Id = 5, Name = "Resource5" });
                resourceCollection.Add(new ResourceObject() { Id = 6, Name = "Resource6" });
                resourceCollection.Add(new ResourceObject() { Id = 7, Name = "Resource7" });
    
                return resourceCollection;
            }
            #endregion
    
            #region Create DataSource for Gantt control
    
            private List<BusinessObject> GetDataSource()
            {
                List<BusinessObject> BusinessObjectCollection = new List<BusinessObject>();
                BusinessObjectCollection.Add(new BusinessObject()
                {
                    Id = 1,
                    Name = "Task 1",
                    StartDate = "10/25/2017",
                    BaselineStartDate = "10/25/2017",
                    BaselineEndDate = "10/30/2017",
                    Duration = 10,
                    PercentDone = 70,
                    Resources = new List<int>() { 1, 2, 4, 5 },
    
                    Children = (new List<BusinessObject>()
                        {
                            new BusinessObject()
                            {
                                Id = 2,
                                Name = "Child task 1",
                                StartDate = "10/25/2017",
                                BaselineStartDate = "10/25/2017",
                                BaselineEndDate = "10/28/2017",
                                Duration = 4,
                                PercentDone = 80,
                                Resources =new List<int>(){ 2,4},
                            },
                            new BusinessObject()
                            {
                                Id = 3,
                                Name = "Child Task 2",
                                StartDate = "10/26/2017",
                                BaselineStartDate = "10/26/2017",
                                BaselineEndDate = "10/30/2017",
                                Duration = 5,
                                PercentDone = 65,
                                Predescessor = "2",
                                Resources =new List<int>(){1},
                            },
                            new BusinessObject()
                            {
                                Id = 4,
                                Name = "Child task 3",
                                StartDate = "10/27/2017",
                                BaselineStartDate = "10/28/2017",
                                BaselineEndDate = "10/30/2017",
                                Duration = 6,
                                PercentDone = 77,
                                Resources =new List<int>(){5},
                                Children = (new List<BusinessObject>()
                                {
                                    new BusinessObject()
                                    {
                                        Id = 5,
                                        Name = "Grand child task 1",
                                        StartDate = "10/30/2017",
                                        BaselineStartDate = "10/29/2017",
                                        BaselineEndDate = "11/03/2017",
                                        Duration = 5,
                                        PercentDone = 60,
                                        Resources =new List<int>(){1,3,7},
                                    },
                                    new BusinessObject()
                                    {
                                        Id = 6,
                                        Name = "Grand child task 2",
                                        StartDate = "10/31/2017",
                                        BaselineStartDate = "10/31/2017",
                                        BaselineEndDate = "11/02/2017",
                                        Duration = 6,
                                        PercentDone = 77,
                                        Predescessor = "5",
                                        Resources =new List<int>(){7},
                                    },
                                    new BusinessObject()
                                    {
                                        Id = 7,
                                        Name = "Grand child task 3",
                                        StartDate = new System.DateTime(2017, 12, 23),
                                        BaselineStartDate = "10/27/2017",
                                        BaselineEndDate = "10/27/2017",
                                        Duration = 0,
                                        PercentDone = 0,
                                        Predescessor = "6"
    
                                    }
                                })
                            }
                        })
    
                });
                return BusinessObjectCollection;
            }
    
            #endregion
    
        }
    }