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

Database Provider

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>
<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