Gantt is empty the first time

3 posts, 0 answers
  1. Richard
    Richard avatar
    9 posts
    Member since:
    Nov 2010

    Posted 09 Jan 2015 Link to this post


    I'm having a problem with the gantt control in my asp web app. To see the content of the gantt control is needed to click twice on it. 

    <telerik:RadGantt runat="server" ID="GanttChart" CssClass="GanttChart" OnDataBound="GanttChart_DataBound"
        Skin="Silk" ListWidth="30%"
        Height="650px" Width="1038px" SelectedView="WeekView" AutoGenerateColumns="false" WorkWeekStart="Monday" WorkWeekEnd="Friday">
            <telerik:GanttBoundColumn DataField="Title" HeaderText="Attivita" DataType="String" UniqueName="Title" Width="150px" AllowEdit="false"></telerik:GanttBoundColumn>
            <telerik:GanttBoundColumn DataField="Start" HeaderText="Inizio" DataType="DateTime" UniqueName="Start" DataFormatString="dd/MM/yy" Width="65px" AllowEdit="false" />
            <telerik:GanttBoundColumn DataField="End" HeaderText="Fine" DataType="DateTime" UniqueName="End" DataFormatString="dd/MM/yy" Width="65px" AllowEdit="false" />
            <telerik:GanttBoundColumn DataField="PercentComplete" HeaderText="Completamento" DataType="Number" UniqueName="PercentComplete" Width="110px" AllowEdit="false" />
        <YearView UserSelectable="true" />
            <TasksDataBindings IdField="ID" ParentIdField="ParentID" StartField="Start" SummaryField="Summary"
                EndField="End" TitleField="Title" PercentCompleteField="PercentComplete" OrderIdField="OrderID" />
            <DependenciesDataBindings TypeField="Type" IdField="ID" PredecessorIdField="PredecessorID"
                SuccessorIdField="SuccessorID" />
    protected override void OnPreRender(EventArgs e)
                //Day View
                GanttChart.DayView.DayHeaderDateFormat = "dddd dd/MM";
                GanttChart.DayView.SlotWidth = Unit.Parse("55px");
                GanttChart.DayView.HourSpan = 1;
                GanttChart.DayView.TimeHeaderDateFormat = "HH:mm";
                //Week View
                GanttChart.WeekView.DayHeaderDateFormat = "ddd dd/MM";
                GanttChart.WeekView.SlotWidth = Unit.Parse("85px");
                GanttChart.WeekView.WeekHeaderDateFormat = "ddd";
                //Month View
                GanttChart.MonthView.WeekHeaderDateFormat = "ddd dd";
                GanttChart.MonthView.SlotWidth = Unit.Parse("110px");
                GanttChart.MonthView.MonthHeaderDateFormat = "MMMM yy";
                //Year View
                GanttChart.YearView.MonthHeaderDateFormat = "MMM";
                GanttChart.YearView.SlotWidth = Unit.Parse("120px");
                GanttChart.YearView.MonthHeaderDateFormat = "Y";
                //Common properties working for all views
                GanttChart.ShowFullTime = true;
                GanttChart.ShowFullWeek = true;
                GanttChart.Culture = CultureInfo.CurrentCulture;
                GanttChart.WorkWeekStart = DayOfWeek.Monday;
                GanttChart.WorkWeekEnd = DayOfWeek.Friday;
                GanttChart.AllowSorting = false;         
    public List<Task> GetGanttDataSource(int projectId)
                List<Task> tasks = new List<Task>();
                var taskResult = GetDbResult(projectId);
                int hasNext = 0;
                foreach (var item in taskResult)
                    Task task = new Task();
                    task.ID = item.Id;
                    task.ParentID = item.ParentId;
                    task.Start = item.Start;
                    task.End = item.End;
                    task.Title = item.Title;
                    task.PercentComplete = item.PercentComplete;
                    if (item.Summary)
                        item.Summary = taskResult.Any(x => x.ParentId == item.Id);
                    task.Summary = item.Summary;
                    task.Expanded = true;
                    task.OrderID = item.OrderId;
                return tasks;

    The control's datasource is correctly loaded even the first time, so is not the way i use the data (or binding) but the page loading or something like this.

    If somebody can help me...

  2. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 14 Jan 2015 Link to this post

    Hi Richard,

    How do you set the datasource? Please attach sample, so we can try to debug your code.


    Hristo Valyavicharski
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Richard
    Richard avatar
    9 posts
    Member since:
    Nov 2010

    Posted 14 Jan 2015 in reply to Hristo Valyavicharski Link to this post

    Hi Hristo,

    Solved!  the problem was caused by an update panel. I've removed the Gantt Control from the update panel and works fine.

    Thanks for the answer!
Back to Top