Gantt - Database Provider

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB
The purpose of this demo is to show how to use the DataSourceView provider to bind the RadGantt control. In order to use the Datasource provider you need to set the DependenciesDataSourceID and DataSourceID properties to the appropriate datasource control. Also you need to set the properties avaiable under the TaskDataBindings and DependenciesDataBindings sections to match the tasks and dependencies fields of the datasources. Then RadGantt will automatically create a DataSourceView provider and will use it to update the information.
  • DefaultCS.aspx
<%@ Page Language="C#"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <div class="demo-container no-bg">
        <telerik:RadGantt RenderMode="Lightweight" ID="RadGantt1" 
            runat="server" 
            DataSourceID="SqlDataSource1" 
            DependenciesDataSourceID="SqlDataSource2" 
            ReadOnly="true" 
            SelectedView="WeekView">
            <DataBindings>
                <TasksDataBindings IdField="ID" ParentIdField="ParentID" StartField="Start" OrderIdField="OrderID" SummaryField="Summary" ExpandedField="Expanded" EndField="End" TitleField="Title"
                    PercentCompleteField="PercentComplete" />
                <DependenciesDataBindings TypeField="Type" IdField="ID" PredecessorIdField="PredecessorID" SuccessorIdField="SuccessorID" />
            </DataBindings>
        </telerik:RadGantt>
    </div>

    <asp:SqlDataSource runat="server" ID="SqlDataSource1" SelectCommand="SELECT * FROM [GanttTasks]" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"/>
    <asp:SqlDataSource runat="server" ID="SqlDataSource2" SelectCommand="SELECT * FROM [GanttDependencies]" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"/>

    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?