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

4 posts, 0 answers
  1. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 24 Oct Link to this post

    How do I get around this problem?
    The ParentNodeId is NULL for 1-4

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

    <telerik:RadNavigation ID="RadNavigation1" DataSourceID="sdsMenu" OnNodeDataBound="RadNavigation1_NodeDataBound" DataFieldID="NodeId" DataFieldParentID="ParentNodeId" DataNavigateUrlField="NavigateUrl" DataTextField="sidnamn" Skin="Bootstrap" runat="server" />
     
    <asp:SqlDataSource ID="sdsMenu" SelectCommand="SELECT NodeId, ParentNodeId, sidnamn, NavigateUrl, target FROM sv_sidor where NodeId NOT BETWEEN @start AND @end Order By SortId ASC, NodeId ASC" ConnectionString="<%$ ConnectionStrings:sdsSleddogConn %>" runat="server">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="start" DbType="Int32" />
            <asp:Parameter DefaultValue="4" Name="end" DbType="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
  2. Peter Milchev
    Admin
    Peter Milchev avatar
    141 posts

    Posted 27 Oct Link to this post

    Hello Kjell,

    You could get around this problem if you also exclude the nodes that have parentId between @start and @end. Here is an example using this Datasource table:

    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
               ProviderName="System.Data.SqlClient"
               SelectCommand="SELECT id, text, parentId from Links WHERE (id NOT BETWEEN @start AND @end) and ([parentId] is NULL or [parentId] not BETWEEN @start AND @end)">
               <SelectParameters>
                   <asp:Parameter DefaultValue="4" Name="start" DbType="Int32" />
                   <asp:Parameter DefaultValue="8" Name="end" DbType="Int32" />
               </SelectParameters>
           </asp:SqlDataSource>

    Regards,
    Peter Milchev
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 27 Oct in reply to Peter Milchev Link to this post

    Same problem/error......

    Se attached image / Datasource table

    <telerik:RadNavigation ID="RadNavigation1" DataSourceID="sdsMenu" DataFieldID="NodeId" DataFieldParentID="ParentNodeId" DataNavigateUrlField="NavigateUrl" DataTextField="sidnamn" Skin="Bootstrap" runat="server" />
                
     <asp:SqlDataSource runat="server" ID="sdsMenu" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="System.Data.SqlClient"
        SelectCommand="SELECT * from sv_sidor WHERE (NodeId NOT BETWEEN @start AND @end) and ([ParentNodeId] is NULL or [ParentNodeId] not BETWEEN @start AND @end)">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="start" DbType="Int32" />
            <asp:Parameter DefaultValue="3" Name="end" DbType="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
  5. Peter Milchev
    Admin
    Peter Milchev avatar
    141 posts

    Posted 31 Oct Link to this post

    Hello Kjell,

    Would you please check again if all the records returned from the "SELECT * from sv_sidor WHERE (NodeId NOT BETWEEN @start AND @end) and ([ParentNodeId] is NULL or [ParentNodeId] not BETWEEN @start AND @end)" query have correct parentIds? For example the record with id 10 that has parentId 67, is there node with id 67 that exists in the filtered list?

    If everything is correct, I would like to ask you to prepare a simplified sample runnable project and send it to us. Thus, we would be able to investigate locally and help you more efficiently.

    Regards,
    Peter Milchev
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Back to Top