New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Import from MS Project

RadGantt control can import and work with MS Project data stored in XML format.

Example

Following code shows how to import MS Project XML data into RadGantt and save it using the Gantt's XML Provider.

  1. Add simple RadGantt definition in the page markup.
<telerik:RadGantt RenderMode="Lightweight" runat="server" ID="RadGantt1" SelectedView="MonthView"></telerik:RadGantt>
<asp:Button ID="btnImport" Text="Import Tasks" runat="server" OnClick="btnImport_Click" />
  1. Configure RadGantt control to use an empty provider.

For the purpose of this demo a XmlGanttProvider is used. But the import functionality works with all supported data binding options of the RadGantt control.

  • ImportedMSProject.xml
<?xml version="1.0" encoding="utf-8"?>
<Project />
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    //Create a new gantt XML file where will stored the imported Data from MS Project
    RadGantt1.Provider = new Telerik.Web.UI.XmlGanttProvider("~/ImportedMSProject.xml");
}
Protected Overrides Sub OnInit(e As EventArgs)
    MyBase.OnInit(e)
    'Create a new gantt XML file where will stored the imported Data from MS Project
    RadGantt1.Provider = New Telerik.Web.UI.XmlGanttProvider("~/ImportedMSProject.xml")
End Sub
  1. Importing the MS Project data is done using the ImportXml method of the gantt. As a parameter is passed the physical path of the data file.
protected void btnImport_Click(object sender, EventArgs e)
{
    RadGantt1.ImportXml(Server.MapPath("MSProjectTasks.xml"));
}
Protected Sub btnImport_Click(sender As Object, e As EventArgs)
    RadGantt1.ImportXml(Server.MapPath("MSProjectTasks.xml"))
End Sub

See Also

In this article