Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    Gantt / Default
    Working Days
    <%@ Page Title="Gantt-Work Week-ASP.NET-SYNCFUSION" Language="C#" MetaDescription="This example illustrates how to define the working days in a week for the Syncfusion Gantt chart control." MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="WorkWeek.aspx.cs" Inherits="WebSampleBrowser.Gantt.WorkWeek" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="SampleHeading" runat="server">
        <span class="sampleName">Gantt / Default</span>
    </asp:Content>
    
    <asp:Content ID="ControlContent" runat="server" ContentPlaceHolderID="ControlsSection">
        <div style="width: 100%; height: 100%; overflow: visible;">
            <ej:Gantt ID="GanttControlDefault" ClientIDMode="Static" runat="server" AllowSelection="true" AllowColumnResize="true"
                TaskIdMapping="Id" TaskNameMapping="Name" ScheduleStartDate="02/23/2017" ScheduleEndDate="03/15/2017"
                StartDateMapping="StartDate" EndDateMapping="EndDate" ProgressMapping="PercentDone" DurationMapping="Duration"
                ChildMapping="Children" AllowGanttChartEditing="false" IncludeWeekend="false"
                TreeColumnIndex="1" IsResponsive="true">
                <SizeSettings Width="100%" Height="450px" />
            </ej:Gantt>
        </div>
    </asp:Content>
    <asp:Content ID="PropertyContent" runat="server" ContentPlaceHolderID="PropertySection">
        <div id="sampleProperties">
            <div class="prop-grid"> 
                <div class="row">
                    <div class="col-md-3">Working Days</div>
                    <div class="col-md-3">
                        <ej:DropDownList ClientIDMode="Static" runat="server" ID="workingdays" Width="105px" ShowCheckbox="true" ClientSideOnChange="onChangeWorkingDays" ClientSideOnCreate="create">
                        </ej:DropDownList>
                    </div>
                </div>
            </div>
        </div>
    </asp:Content>
    <asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ScriptSection">
        <script type="text/javascript">
            $(document).ready(function () {
                $("#sampleProperties").ejPropertiesPanel();
            });
            function load(args) {
                this.getColumns()[0].width = 60;
                this.getColumns()[0].visible = false;
            }
            function onChangeWorkingDays(args) {
                var workweek = [], array = args.model.selectedItems.sort();
                for (i = 0; i < args.model.selectedItems.length; i++) {
                    workweek.push(args.model.dataSource[array[i]]);
                }
                $("#GanttControlDefault").ejGantt("option",{ "workWeek": workweek });
            }
            function create(e) {
                var dropDown = $("#workingdays").data('ejDropDownList');
                dropDown.selectItemsByIndices("1,2,3,4,5");
            }
    
     </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 WorkWeek : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                var DataSource = this.GetDataSource();
                this.GanttControlDefault.DataSource = DataSource;
                this.GanttControlDefault.DataBind();
                this.workingdays.DataSource = new List<string>() { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
            }
    
            #region Create DataSource for Default Gantt control
    
            private List<BusinessObject> GetDataSource()
            {
                List<BusinessObject> list = new List<BusinessObject>();
    
                list.Add(new BusinessObject()
                {
                    Id = 1,
                    Name = "Parent Task 1",
                    StartDate = "02/23/2017",
                    EndDate = "02/27/2017",
                    PercentDone = "40",
                    Duration= 4,
                    Children = (new List<BusinessObject>()
                        {
                            new BusinessObject()
                            {
                                Id = 2,
                                Name = "Child Task 1",
                                StartDate = "02/23/2017",
                                EndDate="02/27/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 3,
                                Name = "Child Task 2",
                                StartDate = "02/23/2017",
                                EndDate="02/27/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 4,
                                Name = "Child Task 3",
                                StartDate = "02/23/2017",
                                EndDate="02/27/2017",
                                PercentDone = "40",
                                Duration= 4
                            }
                        })
    
                });
    
                list.Add(new BusinessObject()
                {
                    Id = 5,
                    Name = "Parent Task 2",
                    StartDate = "03/14/2017",
                    EndDate = "03/18/2017",
                    PercentDone = "40",
                    Duration= 4,
                    Children = (new List<BusinessObject>()
                        {
                            new BusinessObject()
                            {
                                Id = 6,
                                Name = "Child Task 1",
                                StartDate = "03/02/2017",
                                EndDate="03/06/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 7,
                                Name = "Child Task 2",
                                StartDate = "03/02/2017",
                                EndDate="03/06/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 8,
                                Name = "Child Task 3",
                                StartDate = "03/02/2017",
                                EndDate="03/06/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 9,
                                Name = "Child Task 4",
                                StartDate = "03/02/2017",
                                EndDate="03/06/2017",
                                PercentDone = "40",
                                Duration= 4
                            }
                        })
    
                });
                list.Add(new BusinessObject()
                {
                    Id = 10,
                    Name = "Parent Task 3",
                    StartDate = "03/09/2017",
                    EndDate = "03/13/2017",
                    PercentDone = "40",
                    Duration= 4,
                    Children = (new List<BusinessObject>()
                        {
                            new BusinessObject()
                            {
                                Id = 11,
                                Name = "Child Task 1",
                                StartDate = "03/9/2017",
                                EndDate="03/13/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 12,
                                Name = "Child Task 2",
                                StartDate = "03/9/2017",
                                EndDate="03/13/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 13,
                                Name = "Child Task 3",
                                StartDate = "03/9/2017",
                                EndDate="03/13/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 14,
                                Name = "Child Task 4",
                                StartDate = "03/9/2017",
                                EndDate="03/13/2017",
                                PercentDone = "40",
                                Duration= 4
                            },
                            new BusinessObject()
                            {
                                Id = 15,
                                Name = "Child Task 5",
                                StartDate = "03/9/2017",
                                EndDate="03/13/2017",
                                PercentDone = "40",
                                Duration= 4
                            }
                        })
                });
                return list;
            }
            #endregion
    
            #region BusinessObject Creation
            public class BusinessObject
            {
                public string StartDate { get; set; }
                public int Id { get; set; }
                public string Name { get; set; }
                public string EndDate { get; set; }
                public int Duration { get; set; }
                public string PercentDone { get; set; }
                public List<object> ResourceID { get; set; }
                public List<BusinessObject> Children { get; set; }
                public string Predescessor { get; set; }
            }
            #endregion
        }
    }