Hi everyone.
I've a problem with my TreeView controls. the problem is;
When I try to bind data from DB to RadTreeView, it gives this error : "This constraint cannot be enabled as not all values have corresponding parent values."
Default.aspx
<body>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MedsConnectionString %>" SelectCommand="sp_MAIN_ACC_TREE" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="ACC_id_A" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
</Scripts>
</telerik:RadScriptManager>
<script type="text/javascript">
//Put your JavaScript code here.
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<div>
<telerik:RadTreeView ID="RadTreeView1" Runat="server" DataFieldID="ACC_ID_A" DataFieldParentID="ACC_PARENT_A" DataSourceID="SqlDataSource1" DataTextField="ACC_NAME_A" DataValueField="ACC_ID_A" Height="131px" OnNodeClick="RadTreeView1_NodeClick">
</telerik:RadTreeView>
</div>
</form>
</body>
DataTable :
ACC_ID_A ACC_NAME_A ACC_PARENT_A
1 Accounting tree NULL
2 essential 1
3 Cars 2
4 Ambulance 3
stored procedure :
ALTER PROCEDURE [dbo].[sp_MAIN_ACC_TREE]
@ACC_id_A as int
AS
BEGIN
with subtree2(ACC_ID_A , ACC_NAME_A , ACC_PARENT_A)
as
(
select * from MAIN_ACC_A where ACC_PARENT_A = @ACC_id_A
union all
select e.ACC_ID_A, e.ACC_NAME_A ,e.ACC_PARENT_A from MAIN_ACC_A
as e inner join subtree2 on subtree2.ACC_ID_A=e.ACC_PARENT_A
)
select * from subtree2
order by ACC_PARENT_A
END
I need solve this problem necessary
thanks