My table
EmpID Name ReportsTo
1 Accounts 0
2 Branches 0
3 Loans 1
4 Incomes 2
Accounts, branches are parents loans incomes their childs
what is the query to return Accounts with childs
@helper GetTreeView(List siteMenu, int parentID)
{
foreach (var i in siteMenu.Where(a => a.ReportsTo.Equals(parentID)))
{
@{var submenu = siteMenu.Where(a => a.ReportsTo.Equals(i.EmpID)).Count();}
@if (submenu > 0)
{
}
else
{
}
@*@i.Name*@
@if (submenu > 0)
{
@Treeview.GetTreeView(siteMenu, i.EmpID)
@* Recursive Call for Populate Sub items here*@
}
}
}
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vinay SinghPosted Jul 8, 2016, 3:08 AM
Posted Jul 8, 2016, 1:59 AM
Nitin SontakkePosted Jul 8, 2016, 1:29 AM