Gantt Rebinding sqldatasource

24 posts, 0 answers
  1. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 31 Aug 2014 Link to this post

    hello guys

               i tried to follow the example given in the website it does not reload data from database using the sqlddatasource. i call the the radgantt.databind() still no load from the database what are the other option to reload my data?

    please help i need this to present on my boss on tuesday

    thanks
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 01 Sep 2014 Link to this post

    Hi Jolan,

    This forum post is duplicated to this one: http://www.telerik.com/forums/gantt-task-and-dependencies

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 02 Sep 2014 in reply to Hristo Valyavicharski Link to this post

    Hello Hristo

              i dont get it i followed the sample you give actually i copy and paste it to my web apps and configure the two tables and bind to sqlDatasource and run  it..when i  click the add task it just prompted me a spinning loading panel and nothing happen..may i ask what was wrong with it.. i go back to the telerik sample and its working and running fine why on my page it does not,what was wrong?

    please help sir..
    thanks
  4. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 04 Sep 2014 Link to this post

    Jolan,

    If the loading icons is spinning for a long time, probably there are errors on the server. Please look in the Network Monitor tool of the browser and look in the response bodies. Are they contain any error information?

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 11 Sep 2014 in reply to Hristo Valyavicharski Link to this post

    Hi Hristo

                  i dont see any error on the browser is there any thing should i check? all the codes are in place. by the way when will be the production version of this Gantt?

    regards
  6. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 15 Sep 2014 Link to this post

    Hi,

    Are you using any of the Server Events of the Gantt control? With the Beta release there were some issues when handling the events, which might be the reason your code is not working. We've fixed these issues and if you download the latest internal build, the gantt should work properly.

    The official version is scheduled to be released on the 22nd of October.

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 17 Sep 2014 in reply to Bozhidar Link to this post

    Hi Bozhidar
     
                      Can you please guide me to download the latest internal build..so i could test and show this to my boss..

    Regards
    Jhols
  8. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 17 Sep 2014 Link to this post

    Hi Jolan,

    In order to be able to get the latest internal builds, you have to have an active license, or at least a trial for Telerik UI for ASP.NET Ajax. For more information you can contact our sales team at sales@telerik.com.

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  9. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 17 Sep 2014 in reply to Bozhidar Link to this post

    Hi Bozhidar

                   can you tell me if this version of mine telerik is this a latest.. v.2014.2.618.40 ?

    Regards
    jhols
  10. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 17 Sep 2014 Link to this post

    Hello,

    The version contains the release date as the third set of digits - in your case 618 which means July 18th, which is the official Q2 2014 release. This is the latest official release. However the internal builds are released on a weekly basis and contain every new bug fix we've done since the release. 

    You can also monitor our release history in the following link:
    http://www.telerik.com/support/whats-new/aspnet-ajax/release-history

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  11. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 17 Sep 2014 in reply to Bozhidar Link to this post

    hi bozhidar

                  so it means if i am going to download this latest release which is july 24 which is 2014 SP1 there will a possibility that my gantt will work?

    regards
    jhols
  12. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 17 Sep 2014 Link to this post

    Hi bozhidar

             i already update my telerik to the latest update of the telerik and successfully i was able to add a task directly to my database using the rdgantt_taskinsert method but the problem is the data was not loaded to the control(gantt) is there a way to load the data..please help

    regards
    jhols
  13. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 18 Sep 2014 Link to this post

    Hi Jolan,

    The service pack doesn't include all the fixes that we've added to the control. Can you confirm that you are using the latest internal build, or the latest service pack? If you don't have the option to get the latest internal build, you can get a preview of the fixes in our upcoming Q3 2014 Beta release, which is scheduled for the 1st of October.

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  14. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 18 Sep 2014 in reply to Bozhidar Link to this post

    Hi Bozhidar
         
                     i downloaded the latest internal build to my project v2014.3.820.0 but still no luck the data that i save to the database still not loaded to the control..please advice

    thanks
    jhols
  15. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 18 Sep 2014 Link to this post

    Hi,

    We can't say what might be the cause of the issue without a working sample of your code that we can test.

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  16. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 19 Sep 2014 in reply to Bozhidar Link to this post

    hi bozhidar
     
                here is my source code below

    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MainForms/MainForm.Master"
        CodeBehind="Gchart.aspx.cs" Inherits="iProjectWebApps.Gchart" %>

    <%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
        <div class="TableStyle">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lbltitle" runat="server" Text="Project" CssClass="labelcolor"></asp:Label>
                    </td>
                    <td>
                        <telerik:RadComboBox ID="rdcboProject" runat="server" Skin="Sunset" Width="200px"
                            AutoPostBack="True" OnSelectedIndexChanged="rdcboProject_SelectedIndexChanged">
                        </telerik:RadComboBox>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td>
                        <telerik:RadGantt ID="rdGantt" runat="server" Width="1300px" Height="450px"
                             SelectedView="MonthView" AutoGenerateColumns="False"
                             ResolvedRenderMode="Classic" DataSourceID="sqldata1" DependenciesDataSourceID="sqldata2"
                             ontaskinsert="rdGantt_TaskInsert"
                             ontaskupdate="rdGantt_TaskUpdate"
                             onnavigationcommand="rdGantt_NavigationCommand" >
                             <DataBindings >
                                 <TasksDataBindings IdField="ID" OrderIdField="OrderID" SummaryField="Summary" ParentIdField="ParentID"
                                     StartField="Start" EndField="End" TitleField="Title" PercentCompleteField="PercentComplete" />
                                 <DependenciesDataBindings TypeField="Type" IdField="ID" PredecessorIdField="PredecessorID"
                                     SuccessorIdField="SuccessorID" />
                             </DataBindings>
                         </telerik:RadGantt>
                         <asp:SqlDataSource runat="server" ID="sqldata1" DataSourceMode="DataReader" SelectCommand="SELECT ID, ParentID, OrderID, Title, Start, [End], PercentComplete, Expanded, Summary FROM GanttTasks"
                             ConnectionString="<%$ ConnectionStrings:DAL.Properties.Settings.iProjectDBConnectionString %>">
                         </asp:SqlDataSource>
                         <asp:SqlDataSource ID="sqldata2" runat="server" DataSourceMode="DataReader" ConnectionString="<%$ ConnectionStrings:DAL.Properties.Settings.iProjectDBConnectionString %>"
                             SelectCommand="SELECT [ID], [PredecessorID], [SuccessorID], [Type] FROM [GanttDependencies]">
                         </asp:SqlDataSource>
                      
                    </td>
                </tr>
            </table>
        </div>
    </asp:Content>

    and this is my codebehind below to insert and update

      protected void rdGantt_TaskInsert(object sender, Telerik.Web.UI.Gantt.GanttEventArgs e)
            {
                foreach (var item in e.Tasks)
                {
                    if (item.ParentID != null)
                    {
                        t.ID = 0;
                        t.ParentID = int.Parse(item.ParentID.ToString());
                        t.OrderID = int.Parse(item.OrderID.ToString());
                        t.Title = item.Title;
                        t.Start = DateTime.Parse(item.Start.ToShortDateString());
                        t.End = DateTime.Parse(item.End.ToLongDateString());
                        t.PercentComplete = decimal.Parse(item.PercentComplete.ToString());
                        t.Expanded = bool.Parse(item.Expanded.ToString());
                        t.Summary = bool.Parse(item.Summary.ToString());

                        _result = DAL.DLGanttChart.InsertGanttTask(t);
                        if (_result == true)
                        {
                            //SqlDataSource sqldata1 = new SqlDataSource();
                            //sqldata1.ID = "sqldata1";
                            //this.Page.Controls.Add(sqldata1);
                            //sqldata1.ProviderName = "System.Data.SqlClient";
                            //sqldata1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DAL.Properties.Settings.iProjectDBConnectionString"].ConnectionString;
                            //sqldata1.SelectCommand = "SELECT ID, ParentID, OrderID, Title, Start, [End], PercentComplete, Expanded, Summary FROM GanttTasks";

                            //SqlDataSource sqldata2 = new SqlDataSource();
                            //sqldata2.ID = "sqldata2";
                            //this.Page.Controls.Add(sqldata2);
                            //sqldata1.ProviderName = "System.Data.SqlClient";
                            //sqldata2.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DAL.Properties.Settings.iProjectDBConnectionString"].ConnectionString;
                            //sqldata2.SelectCommand = "SELECT [ID], [PredecessorID], [SuccessorID], [Type] FROM [GanttDependencies]";

                            //this.rdGantt.DataSourceID = "sqldata1";
                            //this.rdGantt.DependenciesDataSourceID = "sqldata2";
                            //this.rdGantt.DataBind();
                        }
                    }
                    else if (item.ID != null)
                    {
                            string itm = item.ID.ToString();
                            if (itm == "")
                            {
                                itm = "0";
                            }
                            t.ParentID = int.Parse(itm.ToString());
                            t.OrderID = int.Parse(item.OrderID.ToString());
                            t.Title = item.Title;
                            t.Start = DateTime.Parse(item.Start.ToShortDateString());
                            t.End = DateTime.Parse(item.End.ToLongDateString());
                            t.PercentComplete = decimal.Parse(item.PercentComplete.ToString());
                            t.Expanded = bool.Parse(item.Expanded.ToString());
                            t.Summary = bool.Parse(item.Summary.ToString());

                            _result = DAL.DLGanttChart.InsertGanttTask(t);
                            if (_result == true)
                            {
                                //SqlDataSource sqldata1 = new SqlDataSource();
                                //sqldata1.ID = "sqldata1";
                                //this.Page.Controls.Add(sqldata1);
                                //sqldata1.ProviderName = "System.Data.SqlClient";
                                //sqldata1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DAL.Properties.Settings.iProjectDBConnectionString"].ConnectionString;
                                //sqldata1.SelectCommand = "SELECT ID, ParentID, OrderID, Title, Start, [End], PercentComplete, Expanded, Summary FROM GanttTasks";

                                //SqlDataSource sqldata2 = new SqlDataSource();
                                //sqldata2.ID = "sqldata2";
                                //this.Page.Controls.Add(sqldata2);
                                //sqldata1.ProviderName = "System.Data.SqlClient";
                                //sqldata2.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DAL.Properties.Settings.iProjectDBConnectionString"].ConnectionString;
                                //sqldata2.SelectCommand = "SELECT [ID], [PredecessorID], [SuccessorID], [Type] FROM [GanttDependencies]";

                                //this.rdGantt.DataSourceID = "sqldata1";
                                //this.rdGantt.DependenciesDataSourceID = "sqldata2";
                                //this.rdGantt.DataBind();
                            }
                      
                       
                    }


                }
            }

            protected void rdGantt_TaskUpdate(object sender, Telerik.Web.UI.Gantt.GanttEventArgs e)
            {
                foreach (var item in e.Tasks)
                {
                    if (item.ID != null)
                    {
                        t.ID = int.Parse(item.ID.ToString());
                        t.ParentID = int.Parse(item.ParentID.ToString());
                        t.OrderID = int.Parse(item.OrderID.ToString());
                        t.Title = item.Title;
                        t.Start = DateTime.Parse(item.Start.ToShortDateString());
                        t.End = DateTime.Parse(item.End.ToLongDateString());
                        t.PercentComplete = decimal.Parse(item.PercentComplete.ToString());
                        t.Expanded = bool.Parse(item.Expanded.ToString());
                        t.Summary = bool.Parse(item.Summary.ToString());

                        _result = DAL.DLGanttChart.InsertGanttTask(t);
                        if (_result == true)
                        {

                        }
                    }


                }
            }

    kindly check if what i missing here.

    thanks
    jhols
  17. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 23 Sep 2014 Link to this post

    Hello,

    Can you confirm that the _result = DAL.DLGanttChart.InsertGanttTask(t) statement successfully inserts a record in your database? For instance After you insert a record, and it doesn't show up in the Gantt right away, does it display on refresh of the whole page? Can you also verify if all the necessary fields of the task record are being inserted in the database. Can you run and show us a SELECT * query of your table before and after the Gantt inserts a record with your logic?

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  18. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 23 Sep 2014 in reply to Bozhidar Link to this post

    hello

                To answer you question;
      1. It does insert record successfully to the database all of fields are filled up on the Task table only
       2. My page refresh after the button click
       3. my query was on the sqldatasource object as i posted above
              for Task Table = this is the datasource object name sqldata1
              for dependencies Table = this is the datasource object name sqldata2

    thanks

  19. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 25 Sep 2014 Link to this post

    Hello,

    What I meant was whether the inserted task is displayed after you refresh the page. I also wanted to see the results of the Select * statemen, in other words the records from the database before and after the insertion. 

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  20. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 25 Sep 2014 in reply to Bozhidar Link to this post

    hello

             Actually it does not displayed the inserted data on the control but it does insert successfully to the database. here is the result sets after clicking the add task button.

    on the GanttTask Table only

    ID        ParentID        OrderID        Title                     Start                     End             PercentComplete        Expanded         Summary
    1                0                    0             New Task         2014-09-01     2014-09-01              0.00                            True                  False
    2                0                    1             New Task         2014-09-01     2014-09-01              0.00                            True                  False
    3                0                    2             New Task         2014-09-01     2014-09-01              0.00                            True                  False
    4                0                    3             New Task         2014-09-01     2014-09-01              0.00                            True                  False


    regards
  21. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 26 Sep 2014 Link to this post

    Hello,

    The data from the table clears out the issue - the tasks are looking for a parent with ID of 0. In order to add a parent task, the ParentID property should be null​​ instead of 0. 

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  22. Jolan
    Jolan avatar
    19 posts
    Member since:
    Jul 2012

    Posted 29 Sep 2014 in reply to Bozhidar Link to this post

    hello

           ok its displayed the data on the control on making the parentID null..question what is the use of parentID column and how can i relate the other task to be the child task of the parent task? one more thing when i click the button  + plus for adding child task its always triggering the insert event of the gantt and it dont show up the menu for add child[below or above].. Sir may i ask if you have a working sample that uses server side code for insert task and dependencies?

    thanks
    jhols
  23. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 30 Sep 2014 Link to this post

    Hi,

    To indicate that a task should be a child, it's ParentID should be equal to the ID of the parent task. The parent task should also have it's summary field set to true (or 1 if the field is of type bit). For instance:
    Parent (ID: 1, ParentID null, summary 1)
    Child(ID: 2, ParentID 1, summary 0)

    The dropdown is displayed when you have a selected task, and is used to insert the new task relative to the selected one - as its child, above or below it. When you don't have a selected task, the button simply appends the new task at the end. 

    I've also attached a sample that uses the events to implement the CRUD operations of a Gantt bound to a List.

    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  24. Alpha
    Alpha avatar
    1 posts
    Member since:
    Feb 2015

    Posted 27 Feb 2015 in reply to Jolan Link to this post

    Your ParentId is 0 Plz replace it with NULL... It will definitely Show. ParentID never  0. it will be null or grater than 0...
Back to Top