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

Treeview populated with undefined values when AutoGenerateColums is false

3 Answers 37 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Tomislav
Top achievements
Rank 1
Tomislav asked on 03 Dec 2014, 03:36 PM
Hi,

i have undefined values when i try to define my own columns, when AutoGenerateColumns = "true" it works fine.

<telerik:RadGantt ID="RadGantt1" runat="server" SelectedView="MonthView" Skin="Silk"  ReadOnly="true" AutoGenerateColumns="false" ListWidth="351px" DataSourceID="TaskSource" DependenciesDataSourceID="DependenciesSource" >
            <YearView UserSelectable="true" />
            <DayView UserSelectable="false" />
            
            <Columns>
                <telerik:GanttBoundColumn DataField="Naziv" DataType="String" Width="120px" AllowEdit="true"></telerik:GanttBoundColumn>
                <telerik:GanttBoundColumn DataField="DatumOd" DataType="DateTime"  Width="40px" ></telerik:GanttBoundColumn>
                <telerik:GanttBoundColumn DataField="DatumDo" DataType="DateTime"  Width="40px" ></telerik:GanttBoundColumn>
            </Columns>
            
            <DataBindings>
                <TasksDataBindings
                    IdField="IdAkcije"  
                    StartField="DatumOd" EndField="DatumDo"
                    ParentIdField="Dependence" SummaryField="Summary"
                    TitleField="Naziv"
                    PercentCompleteField="PercentComplete"  />
                <DependenciesDataBindings
                     IdField="IdAkcije"
                    PredecessorIdField="PredecessorID"
                    SuccessorIdField="SuccessorID"
                    TypeField="Type" />
            </DataBindings>
            <Localization HeaderMonth="<%$ GetString: 24_Py_Mjesec %>" HeaderWeek="<%$ GetString: 00_Pub_Week %>" />
        </telerik:RadGantt>
    </div>

    <asp:SqlDataSource runat="server" ID="TaskSource" ConnectionString="<%$ ConnectionStrings: HrNet.Core.SqlServer %>" SelectCommandType="StoredProcedure" SelectCommand="gorGanttPregled" ProviderName="System.Data.SqlClient">
    </asp:SqlDataSource>

    <asp:SqlDataSource runat="server" ID="DependenciesSource" ConnectionString="<%$ ConnectionStrings: HrNet.Core.SqlServer %>" SelectCommandType="StoredProcedure" SelectCommand="gorGanttDependanciesPregled" ProviderName="System.Data.SqlClient">
    </asp:SqlDataSource>

3 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 05 Dec 2014, 07:07 AM
Hi,

I've attached a small sample page demonstrating the Manually defined columns working accordingly. You can test it on your end to verify the functionality. 

I also noticed that in your sample you are using a stored procedure to load the tasks and dependencies. If this is the source of the issue, could you modify the sample so that it uses a stored procedure similar to yours and send it back to us, so that we can test it locally?

Regards,
Bozhidar
Telerik
0
Sypher
Top achievements
Rank 1
answered on 06 Aug 2015, 07:33 PM

I'm seeing the same issue, also using a stored procedure. Using 2014.2.274.45 in Visual Studio 2015. If I use AutoGenerateColumns="true", the columns populate. If I set that to false and choose columns to show just like Tomislav did, the columns just show "undefined" as the value. Attached is a screenshot of the gantt chart pulling in data from our database via a stored procedure. I tried editing the sample project from Bozhidar, but I couldn't get the sample database file to connect with the SqlDataSource after I upgraded it to work in VS 2015.

0
Sypher
Top achievements
Rank 1
answered on 06 Aug 2015, 08:09 PM

After upgrading to the latest version (2015.2.729.45) , I noticed a few changes:

  • The columns no longer show "undefined". They just show blanks.
  • Turning AutoGenerateColumns="true" now shows both the generated columns and the declared columns.
  • Changing my DataFields to use the gantt chart's field names instead of my column names fixes the issue!

So, for the DataField="Naziv" in Tomislav's example, it should instead be DataField="Title"!

That makes no sense to me, as I would expect the DataField names to come from my data source just like they do in every other ASP.NET AJAX control, but now that I know what's going on, I can work around it.

Tags
Gantt
Asked by
Tomislav
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Sypher
Top achievements
Rank 1
Share this question
or