This constraint cannot be enabled as not all values have corresponding parent values

3 posts, 0 answers
  1. Simon
    Simon avatar
    2 posts
    Member since:
    Mar 2013

    Posted 08 Mar 2013 Link to this post

    Hi,
    i already check on forum that this problem happened to other users, i tried solution but doesn't work...

    here is from sql query:

    siteid userid username  sitename
    331 13        Simon  Paris 15ème
    2167 13        Simon       Silac
    330 13        Simon    Zonya

    here is .cs code:

     private void GenerateTreeView()
        {
            OleDbConnection dbCon = new OleDbConnection("Provider=SQLOLEDB;Data Source=PC-DEV002\\SQLEXPRESS;Persist Security Info=True;Password=dcube2005*;User ID=sa;Initial Catalog=SuiviConso");
            dbCon.Open();
            OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT  su.SiteId, u.userid, u.nomUser, s.NomSite FROM   [User] AS u LEFT OUTER JOIN  Rel_Site_User AS su ON su.UserId = u.UserId LEFT OUTER JOIN Sites AS s ON s.SiteID = su.SiteId WHERE        (su.UserId = 13) ", dbCon);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
            RadTreeView1.DataFieldID = "SiteId";
            RadTreeView1.DataFieldParentID = "UserId";
            RadTreeView1.DataTextField = "nomUser";
            RadTreeView1.DataValueField = "NomSite";
            RadTreeView1.DataSource = ds;
            RadTreeView1.DataBind();
            RadTreeView1.ExpandAllNodes();
        }
    Here is the aspx:
     <telerik:RadTreeView ID="RadTreeView1" runat="server" Width="100%" Height="250px">
                    <DataBindings>
                        <telerik:RadTreeNodeBinding Expanded="true"></telerik:RadTreeNodeBinding>
                    </DataBindings>
                </telerik:RadTreeView>

    So ,code is quite easy, i just don't get how to solve the problem ??

    THanks

    I expect something like this:

    *Simon
               ->paris 15
       ->Silac
       ->Zonya


  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 12 Mar 2013 Link to this post

    Hello Simon,

    Please take a look at the following help articles which explain in detail what kind of binding is supported by RadTreeView and how your data should be structured:
    http://www.telerik.com/help/aspnet-ajax/treeview-data-binding-hierarchical.html
    http://www.telerik.com/help/aspnet-ajax/treeview-data-binding-loading-related-tables.html
     

    Greetings,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Simon
    Simon avatar
    2 posts
    Member since:
    Mar 2013

    Posted 12 Mar 2013 Link to this post

    Hi,

    i am gonna check articles,

    thanks a lot for the reply,

    Simon
Back to Top