Edit this page

XML Provider Binding

This help article describes how use Gantt Resources with the built-in Xml Provider.

There is not much difference in using XML Provider with Resources compared to using Xml Provider without resources. Just set the EnableResources property of the Gantt to true and extend the XML file to support resources.

caution

Gantt expects that the Resources are defined. It does not provide mechanism to manipulate them.

The example provided below illustrates a possible implementation of RadGantt with Resources, bound to XML Provider.

<telerik:RadGantt RenderMode="Lightweight" ID="RadGantt1" runat="server" AutoGenerateColumns="false" SelectedView="WeekView" EnableResources="true">
    <Columns>
        <telerik:GanttBoundColumn DataField="Title" DataType="String"></telerik:GanttBoundColumn>
        <telerik:GanttResourceColumn HeaderText="Asssigned Resources"></telerik:GanttResourceColumn>
    </Columns>
</telerik:RadGantt>
protected void Page_Load(object sender, EventArgs e)
{
    RadGantt1.Provider = new XmlGanttProvider(Server.MapPath("App_Code/Gantt.xml"));
}
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    RadGantt1.Provider = New XmlGanttProvider(Server.MapPath("App_Code/Gantt.xml"))
End Sub

The format of the XML file that contains the data should look similar to the shown below.

<?xml version="1.0" encoding="utf-8"?>
<Project>
  <Tasks />
  <Dependencies />
  <Assignments />
  <Resources>
    <Resource>
      <ID>1</ID>
      <Text>Thomas Hardy</Text>
      <Color>#f44336</Color>
    </Resource>
    <Resource>
      <ID>2</ID>
      <Text>Elizabeth Lincoln</Text>
      <Color>#880e4f</Color>
    </Resource>
  </Resources>
</Project>

See Also