We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Gantt chart SQL connection

I am trying to start the Gantt Chart control in conjunction with the SQL database. On the forum I found an example from 2017 but unfortunately it does not work properly - the task object is not added to the database and after manually added in the database there is a Javascript error in the browser. Is it possible to obtain the current example of combining this control (in version 17.1) with the database.

1 Reply

PP Pooja Priya Krishna Moorthy Syncfusion Team June 5, 2019 10:58 AM UTC

Hi Adam, 
 
Greetings from Syncfusion support. 
 
We are prepared a Gantt sample and loaded tasks from SQL database and updated the database on CRUD action in source version 17.1.0.38. 
Please find the code example below. 
 
 
<ej:Gantt ID="Gantt1" runat="server" 
//… 
ActionComplete="ActionComplete"> 
</ej:Gantt> 
 
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="True" /> 
<script type="text/javascript">             
 
            function ActionComplete(args) { 
                if (args.requestType == "save" && args.addedRecord) { 
                    var data = args.addedRecord.item; 
                    PageMethods.AddIt(data); 
                } 
            } 
</script> 
 
 
 
[WebMethod] 
        public static void AddIt(TaskData record) 
        { 
            GanttSample sample = new GanttSample(); 
            sample.Add(record); 
 
        } 
 
       public void Add(TaskData Task) 
        { 
 
            GanttData data = new GanttData 
            { 
                TaskId = Task.TaskId, 
                //... 
            }; 
            db.GanttDatas.Add(data); 
            db.SaveChanges();         
        } 
         
 
Please, find the sample and KB link below. 
 
Please get back to us if you require further assistance on this. 
 
Regards, 
Pooja Priya K. 


Loader.
Live Chat Icon For mobile
Up arrow icon