This is a migrated thread and some comments may be shown as answers.

Gantt bind to RadGrid

0 Answers 88 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
SURYA
Top achievements
Rank 2
SURYA asked on 04 Jun 2017, 05:58 AM
I have a Gantt which is bind to Radgrid. RadGrid has some employee list which will have separate task in Gantt. But this code is not working, where I am being wrong.
 
<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="-1" DataSourceID="EmployeeSource" GridLines="Both" GroupPanelPosition="Top" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" ShowGroupPanel="True" EnableHeaderContextAggregatesMenu="True" EnableHeaderContextFilterMenu="True" EnableHeaderContextMenu="True" PageSize="5">
                    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                    <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True" EnablePostBackOnRowClick="True">
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <MasterTableView DataKeyNames="EmpID" DataSourceID="EmployeeSource" AutoGenerateColumns="False" CommandItemDisplay="Top" EnableHeaderContextAggregatesMenu="True">
                        <CommandItemSettings ShowAddNewRecordButton="False" ShowExportToCsvButton="True" ShowExportToExcelButton="True" ShowExportToPdfButton="True" ShowExportToWordButton="True" />
                        <Columns>
                            <telerik:GridBoundColumn DataField="RegistrationID" HeaderText="RegistrationID" SortExpression="RegistrationID" UniqueName="RegistrationID" HeaderStyle-Width="150px" FilterControlWidth="110px" DataType="System.Int64" FilterControlAltText="Filter RegistrationID column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EmpID" HeaderStyle-Width="150px" FilterControlWidth="110px" DataType="System.Int64" FilterControlAltText="Filter EmpID column" HeaderText="EmpID" ReadOnly="True" SortExpression="EmpID" UniqueName="EmpID" Display="True"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" UniqueName="FirstName" FilterControlAltText="Filter FirstName column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName" UniqueName="LastName" FilterControlAltText="Filter LastName column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Gender" HeaderText="Gender" SortExpression="Gender" UniqueName="Gender" FilterControlAltText="Filter Gender column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DateOfBirth" HeaderText="DateOfBirth" SortExpression="DateOfBirth" UniqueName="DateOfBirth" DataType="System.DateTime" FilterControlAltText="Filter DateOfBirth column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Mobile" HeaderText="Mobile" SortExpression="Mobile" UniqueName="Mobile" HeaderStyle-Width="150px" FilterControlWidth="110px" DataType="System.Int64" FilterControlAltText="Filter Mobile column"></telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
                <asp:SqlDataSource runat="server" ID="EmployeeSource" SelectCommand="SELECT [EmpID], [RegistrationID], [FirstName], [LastName], [Gender], [DateOfBirth], [Mobile], [Email] FROM [Employee] WHERE ([Status] = 'Employee')"></asp:SqlDataSource>
                <telerik:RadGantt runat="server" ID="RadGantt1" DataSourceID="TasksDataSource" Height="600px" ListWidth="350px" DependenciesDataSourceID="DependenciesDataSource" SelectedView="WeekView" AutoGenerateColumns="false">
                    <Columns>
                        <telerik:GanttBoundColumn DataField="Title" DataType="String" Width="120px"></telerik:GanttBoundColumn>
                        <telerik:GanttBoundColumn DataField="StartDate" DataType="DateTime" DataFormatString="dd/MM/yy" Width="40px"></telerik:GanttBoundColumn>
                        <telerik:GanttBoundColumn DataField="EndDate" DataType="DateTime" DataFormatString="dd/MM/yy" Width="40px"></telerik:GanttBoundColumn>
                    </Columns>
                    <DataBindings>
                        <TasksDataBindings IdField="TaskID" ParentIdField="ParentID" StartField="StartDate" EndField="EndDate" OrderIdField="EmpID" SummaryField="Summary" TitleField="Title" PercentCompleteField="PercentComplete" />
                        <DependenciesDataBindings TypeField="Type" IdField="TaskDependenciesID" PredecessorIdField="PredecessorID" SuccessorIdField="SuccessorID" />
                    </DataBindings>
                </telerik:RadGantt>
                <asp:SqlDataSource ID="TasksDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SMSConnectionString %>" DeleteCommand="DELETE FROM [Task_Employee] WHERE [TaskID] = @TaskID" InsertCommand="INSERT INTO [Task_Employee] ([ParentID], [EmpID], [Title], [StartDate], [EndDate], [PercentComplete], [Expanded], [Summary]) VALUES (@ParentID, @EmpID, @Title, @StartDate, @EndDate, @PercentComplete, @Expanded, @Summary)" SelectCommand="SELECT [TaskID], [ParentID], [EmpID], [Title], [StartDate], [EndDate], [PercentComplete], [Expanded], [Summary] FROM [Task_Employee] " UpdateCommand="UPDATE [Task_Employee] SET [ParentID] = @ParentID, [EmpID] = @EmpID, [Title] = @Title, [StartDate] = @StartDate, [EndDate] = @EndDate, [PercentComplete] = @PercentComplete, [Expanded] = @Expanded, [Summary] = @Summary WHERE [TaskID] = @TaskID">
                    <DeleteParameters>
                        <asp:Parameter Name="TaskID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="ParentID" Type="Int32" />
                        <asp:Parameter Name="EmpID" Type="Int32" />
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="StartDate" Type="DateTime" />
                        <asp:Parameter Name="EndDate" Type="DateTime" />
                        <asp:Parameter Name="PercentComplete" Type="Decimal" />
                        <asp:Parameter Name="Expanded" Type="Boolean" />
                        <asp:Parameter Name="Summary" Type="Boolean" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="RadGrid1" PropertyName="SelectedValue" Name="EmpID" Type="Int32"></asp:ControlParameter>
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="ParentID" Type="Int32" />
                        <asp:Parameter Name="EmpID" Type="Int32" />
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="StartDate" Type="DateTime" />
                        <asp:Parameter Name="EndDate" Type="DateTime" />
                        <asp:Parameter Name="PercentComplete" Type="Decimal" />
                        <asp:Parameter Name="Expanded" Type="Boolean" />
                        <asp:Parameter Name="Summary" Type="Boolean" />
                        <asp:Parameter Name="TaskID" Type="Int32"></asp:Parameter>
                    </UpdateParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="DependenciesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SMSConnectionString %>" DeleteCommand="DELETE FROM [Task_EmployeeDependencie] WHERE [TaskDependenciesID] = @TaskDependenciesID" InsertCommand="INSERT INTO [Task_EmployeeDependencie] ([PredecessorID], [SuccessorID], [Type]) VALUES (@PredecessorID, @SuccessorID, @Type)" SelectCommand="SELECT [TaskDependenciesID], [PredecessorID], [SuccessorID], [Type] FROM [Task_EmployeeDependencie]" UpdateCommand="UPDATE [Task_EmployeeDependencie] SET [PredecessorID] = @PredecessorID, [SuccessorID] = @SuccessorID, [Type] = @Type WHERE [TaskDependenciesID] = @TaskDependenciesID">
                    <DeleteParameters>
                        <asp:Parameter Name="TaskDependenciesID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="PredecessorID" Type="Int32" />
                        <asp:Parameter Name="SuccessorID" Type="Int32" />
                        <asp:Parameter Name="Type" Type="Int32" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="PredecessorID" Type="Int32" />
                        <asp:Parameter Name="SuccessorID" Type="Int32" />
                        <asp:Parameter Name="Type" Type="Int32" />
                        <asp:Parameter Name="TaskDependenciesID" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>

No answers yet. Maybe you can help?

Tags
Gantt
Asked by
SURYA
Top achievements
Rank 2
Share this question
or