This is a migrated thread and some comments may be shown as answers.

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

3 Answers 25 Views
Navigation
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 24 Oct 2016, 11:57 AM

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>

3 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 27 Oct 2016, 08:38 AM
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.
0
Kjell
Top achievements
Rank 1
answered on 27 Oct 2016, 09:27 AM

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>
0
Peter Milchev
Telerik team
answered on 31 Oct 2016, 05:21 PM
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.
Tags
Navigation
Asked by
Kjell
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Kjell
Top achievements
Rank 1
Share this question
or