TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
madhu goud
NA
36
14.3k
How to retrieve tree view based on id from database table
Jul 8 2016 1:20 AM
am binding tree view from database ,i have 4 parents with their childs in my tree view am binding all parents with childs. But i want to bind only a particular parent with their childs , how to write query for that
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<AccountsPageLayout.MasterNode> siteMenu, int parentID)
{
foreach (var i in siteMenu.Where(a => a.ReportsTo.Equals(parentID)))
{
<li>
@{var submenu = siteMenu.Where(a => a.ReportsTo.Equals(i.EmpID)).Count();}
@if (submenu > 0)
{
<span class="collapse collapsible"> </span>
}
else
{
<span style="width:15px; display:inline-block"> </span>
}
<span>
<a href="#">@i.Name</a>
@*<a href="@i.EmpID">@i.Name</a>*@
</span>
@if (submenu > 0)
{
<ul>
@Treeview.GetTreeView(siteMenu, i.EmpID)
@* Recursive Call for Populate Sub items here*@
</ul>
}
</li>
}
}
Reply
Answers (
3
)
how t create mvc application using three tier architecure.
validation comparevalidator FOR BIND TEXTBOX in gridview