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

Read data dynamically

Hello,

sorry for may bad english. My problem is follow: I need to read dynamically data for the ejGantt using c# public class. I tried it this way:

ascx file:

<script type="text/javascript">
    dataSource = "<%=GanttData%>";
    var datamanager = ej.DataManager(dataSource);
...

    $(function () {
        $("#Grid").ejGantt({
            dataSource: datamanager,
...
            }
});
    });
</script>


code behind file:

public VirtualizationData[] GanttData
{
get { return GetData(); }
}

public static VirtualizationData[] GetData()
{
List<VirtualizationData> list = new List<VirtualizationData>();
list.Add(new VirtualizationData()
{
Id = 1,
Name = "Task1",
PercentDone = 50,
StartDate = "01/17/2010",
Duration = 5
});

         return list.ToArray();
}

 public class VirtualizationData
{
public string StartDate { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public int Duration { get; set; }
public int PercentDone { get; set; }
public VirtualizationData[] Children { get; set; }
public string Predescessor { get; set; }


But datamanager contains the 'Name' of data class instead data values.
       
What am I doing incorrectly ?

Thanks and BR
Oto

3 Replies

BM Bharath Marimuthu Syncfusion Team May 21, 2014 09:54 AM UTC

Hi Oto,

 

Sorry about the inconvenience caused.

 

We have analyzed the provided code snippet but we are unable to understand your requirement. Since we don’t have the dataManager support in our ejGantt control but you have tried to use ej.DataManager. So could you please share us your sample or more details related to this query to explain the working scenario? This would be very helpful for us to serve you to provide a proper solution.

 

Please let me know if you require further assistance on this.

 

Thanks,

Bharath 



ON Otomar Naprstek June 10, 2014 08:29 AM UTC

I found the solution:

ascx file:

<script type="text/javascript">
    var data = "<%=GanttData%>";
...

    $(function () {
        $("#Grid").ejGantt({
            dataSource: data,
...
            }
});
    });
</script>

code behind file:

public VirtualizationData[] GanttData
{
        JavaScriptSerializer serializer = new JavaScriptSerializer();
get { return serializer.Serialize(GetData()); }
}

And now the data vlaues are comming.

BR
Oto


BM Bharath Marimuthu Syncfusion Team June 11, 2014 07:30 AM UTC

Hi Otomar ,

 

Thanks for your update .

 

We are glad to know that your issue has been resolved . Please let us know if you require any further assistance on this.

 

Regards,

Bharath.


Loader.
Live Chat Icon For mobile
Up arrow icon