Save data to database

Is there a way to save gantt control data to database?

3 Replies

RS Ramya Soundar Rajan Syncfusion Team May 19, 2020 10:05 AM UTC

Hi Mariusz Juszkiewicz, 
  
Greeting from Syncfusion. 
  
We have analyzed your requirement and we would like to inform that currently we don’t have direct support to get data from GanttControl to save in DataBase.   
  
We have prepared a sample to achieve your requirement by getting data from DataTable then converting the DataTable into ObservableCollection and bind it with Gantt’s ItemsSource. In sample, we have added button click to convert the Gantt's control data from ItemsSource property to the DataTable. Now, you can save the Gantt's control data into DataBase using DataTable.  
  
CodeSnippet: 
 
    private DataTable SaveData(ObservableCollection<TaskDetails> itemsSource) 
    { 
        table.Rows.Clear();  
 
        // To convert the gantt data to data table            
        for (int i = 0; i < itemsSource.Count; i++) 
        { 
            table.Rows.Add(itemsSource[i].StartDate, itemsSource[i].FinishDate, itemsSource[i].TaskName, itemsSource[i].TaskId); 
        } 
        return table; 
    } 
 
    private void Button_Click(object sender, RoutedEventArgs e) 
    { 
        SaveData(ganttData); 
    } 
 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Ramya S 



MJ Mariusz Juszkiewicz May 25, 2020 03:37 AM UTC

Thank you.
Is it possible to the same in Entity Framework?
I have been trying to map through external property binding, howver, I was unsuccessful.
One more question is there possiblity to print Gantt chart?

Thanks
Mariusz


RS Ramya Soundar Rajan Syncfusion Team May 26, 2020 02:41 PM UTC

Hi Mariusz, 
 
Query 1: I have been trying to map through external property binding, however, I was unsuccessful. 
 
We have prepared a sample to bind external property. Please find the sample from below location. 
 
 
Could you please check with attached sample and let us know whether your reported problem reproduced or not? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application scenario or provide the sample. This will be helpful for us to provide better solution at the earliest. 
 
Query 2: One more question is there possiblity to print Gantt chart? 
 
We would like to let you know that in GanttControl we can able to export gantt to image from that you can print. Please find the sample from below location. 
 
 
Query 3: Is it possible to the same in Entity Framework? 
 
We would like to let you know that we can achieve in entity framework by using data from ItemsSource property Gantt Control. 
 
Regards, 
Ramya S 


Loader.
Up arrow icon