Databinding w/ParentID Issue

3 posts, 0 answers
  1. Dwayne Starkey
    Dwayne Starkey avatar
    48 posts
    Member since:
    Aug 2009

    Posted 28 Jan 2010 Link to this post

    I am trying to get my treeview to databind using the settings below. I keep getting the error listed below.
    "A critical error has occurred.
    This constraint cannot be enabled as not all values have corresponding parent values."


    If I remove DataFieldParentID the treeview does bind and shows a list. I tried using 0 and NULL for my parents. Any suggestions?

    List I get if I remove the parentID:
    Management
    General
    Detail Orders
    Test


    RadTreeView1.DataSource = tree.Treeview

    RadTreeView1.DataFieldID =

    "rID"

     

    RadTreeView1.DataFieldParentID =

    "ParentID"

     

    RadTreeView1.DataTextField =

    "Text"

     

    RadTreeView1.DataValueField =

    "url"

     

    RadTreeView1.DataBind()



    rID  ParentID    Text                  url
    1    0               Management     NULL
    2    0               General             NULL
    3    2               Detail Orders    ~/Test.aspx  
    4    1               Test                  ~/Test.aspx  
  2. chrisjoelcowan
    chrisjoelcowan avatar
    6 posts
    Member since:
    Jun 2007

    Posted 28 Jan 2010 Link to this post

    When binding a DataTable to a tree view I used DbNull for top level nodes.
  3. Dwayne Starkey
    Dwayne Starkey avatar
    48 posts
    Member since:
    Aug 2009

    Posted 29 Jan 2010 Link to this post

    I guess as shit down was needed. This morning everything is working as expected....


Back to Top