RadTreeView Error When Parent Null

4 posts, 0 answers
  1. Mark
    Mark avatar
    127 posts
    Member since:
    May 2013

    Posted 13 Jan 2014 Link to this post

    Hi all,

    I have a SQL Data Source with three columns for simplicity (Organization_Name, Organization_ID, Organization_Parent_ID).

    I am receiving the following error, "This constraint cannot be enabled as not all values have corresponding parent values."  This makes sense as some of the Organization_Parent_ID values are null.  How can I circumvent this error message, showing all of the parent organizations with their children underneath?

    It should look something like this:

    Organization_A
    Organization_B
    Organization_C
    Organization_D
              Sub_Organization_A
              Sub_Organization_B
    Organization_E

    I see in the Object Data Source example in this link that there are multiple root level items as well.

    Thanks,
    Mark




  2. Mark
    Mark avatar
    127 posts
    Member since:
    May 2013

    Posted 15 Jan 2014 Link to this post

    Anyone . . . ?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Jan 2014 Link to this post

    Hi Mark,

    Unfortunately I couldn't replicate the issue at my end. Please have a look into the sample code snippet I tried with SqlDataSource which works fine at my end.

    ASPX:
    <telerik:RadTreeView ID="RadTreeView1" runat="server" DataFieldID="Organization_ID" DataFieldParentID="Organization_Parent_ID"
        DataSourceID="SqlDataSource1" DataTextField="Organization_Name">
    </telerik:RadTreeView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Northwind_newConnectionString %>"
        SelectCommand="SELECT [Organization_Name], [Organization_ID], [Organization_Parent_ID] FROM [Organization]">
    </asp:SqlDataSource>

    Thanks,
    Princy.
  5. Mark
    Mark avatar
    127 posts
    Member since:
    May 2013

    Posted 16 Jan 2014 Link to this post

    Princy,

    Thank you very much for the reply!

    Unfortunately, my solution is entirely in code-behind as part of a SharePoint Web Part.  It looks very similar to yours.  The RadTreeView and SQLDataSource are added in CreateChildControls.  Any thoughts?

    Thanks,
    Mark
Back to Top