Parent Columns and Child Columns don't have matching columns

4 posts, 0 answers
  1. Adela
    Adela avatar
    3 posts
    Member since:
    Nov 2014

    Posted 07 Nov 2014 Link to this post

    Hi,

    I'm trying to use programmatic data binding, as in this demo http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/databinding/defaultcs.aspx
    But I'm getting the message error: 

    Parent Columns and Child Columns don't have matching columns (my SO is in spanish, so the original message is "Las columnas primarias y las columnas secundarias no tienen columnas que coincidan.")

    Attached is an image of my data and this is my code:

        System.Data.DataSet ds = st.getFileStructure();

         treeView.DataTextField = "leafDisplayName";
         treeView.DataFieldID = "leafName";
         treeView.DataFieldParentID = "Parent";
     
         treeView.DataSource = ds;
         treeView.DataBind();

    and this is my stack trace:  

    [InvalidConstraintException: Las columnas primarias y las columnas secundarias no tienen columnas que coincidan.]
    POsWorkflow.UserControls.FileStructureCtrl.BindToDataSet(RadTreeView treeView, Boolean isGidStructure) in C:\Users\...\UserControls\FileStructureCtrl.ascx.cs:217
    POsWorkflow.UserControls.FileStructureCtrl.Page_Load(Object sender, EventArgs e) in C:\Users\...\UserControls\FileStructureCtrl.ascx.cs:65
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
    System.Web.UI.Control.OnLoad(EventArgs e) +92
    System.Web.UI.Control.LoadRecursive() +54
    System.Web.UI.Control.LoadRecursive() +145
    System.Web.UI.Control.LoadRecursive() +145
    System.Web.UI.Control.LoadRecursive() +145
    System.Web.UI.Control.LoadRecursive() +145
    System.Web.UI.Control.LoadRecursive() +145
    System.Web.UI.Control.LoadRecursive() +145
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772


    I don´t know what i'm doing wrong. Some body help :(

    Thanks in advance.



  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 11 Nov 2014 Link to this post

    Hi,

    Could you specify whether the two columns in your SQL table have the same data type?

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adela
    Adela avatar
    3 posts
    Member since:
    Nov 2014

    Posted 11 Nov 2014 in reply to Bozhidar Link to this post

     
    Bozhidar said:Hi,

    Could you specify whether the two columns in your SQL table have the same data type?

    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.

     


    Hi Bozhidar,

    Attached is an image showing the result set that I'm using, Parent and child columns are int type. 
    I'm also trying with declarative binding, but I get the same message error.

    1.<telerik:RadTreeView ID="treeSupplier" runat="server" DataFieldID="leafName"
    2.     DataFieldParentID="Parent" DataSourceID="SqlDataSource1">
    3.     <DataBindings>
    4.         <telerik:RadTreeNodeBinding TextField="leafDisplayName" />
    5.         <telerik:RadTreeNodeBinding Depth="0" TextField="leafDisplayName" />
    6.     </DataBindings>
    7. </telerik:RadTreeView>

    I realized that when the datasource only contains two hierarchy levels (I refer to row 1 to 11 in the attached image) the treeview shows perfectly, but when the datasource includes also rows 12-14 I get the error.
    :(

  5. Adela
    Adela avatar
    3 posts
    Member since:
    Nov 2014

    Posted 11 Nov 2014 Link to this post

    Solved!

    My stored procedure makes a Union between two tables (folders and documents). I guess the problem was the size of the columns is different. My solution was:
    select
             convert(int,leafName) leafName
            , convert(varchar(255),leafDisplayName) leafDisplayName
    -- etc
    from (
    -- union
    )t

    Thanks anyway!
Back to Top