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
Abhilash J A
533
2.4k
598k
Recursive Parent Child hierarchy with checkbox MVC 5
Feb 23 2017 6:58 AM
Hello everyone,
I want to bind Html like recursive Parent Child hierarchy with checkbox.
I have tried by foreach loop but showing only one productcategoryname.
@model List
<
Rebox.BIL.DataModel.ProductCategoryDM
>
@{
Layout
=
"~/Views/Shared/_Layout.cshtml"
;
}
<!DOCTYPE html
>
<
html
>
<
body
>
<
div
class
=
"board-canvas m-t-20"
>
@foreach (var item in Model)
{
if (
item.idParentCategoryProduct
== 0)
{
<
div
id
=
"board"
class
=
"u-fancy-scrollbar js-no-higher-edits js-list-sortable ui-sortable"
>
<
div
class
=
"js-list list-wrapper list-padding u-fancy-scrollbar"
>
<
ul
class
=
"offered-list"
>
<
li
>
<
div
class
=
"checkbox "
>
<
label
class
=
"hd-txt"
>
<
input
type
=
"checkbox"
value
=
""
>
@item.ProductCategoryName
</
label
>
</
div
>
</
li
>
@if (item.idParentCategoryProduct != 0)
{
<
li
>
<
div
class
=
"checkbox "
>
<
label
>
<
input
type
=
"checkbox"
value
=
""
>
@item.ProductCategoryName
</
label
>
</
div
>
@Html.Partial("_productOffered", item)
</
li
>
}
</
ul
>
</
div
>
</
div
>
}
}
</
div
>
</
body
>
</
html
>
It is the child partial view page,
@model Rebox.BIL.DataModel.ProductCategoryDM
@{
}
@foreach (var item in Model.productCategory)
{
<
ul
class
=
"offered-sub-list"
>
@if (item != null)
{
<
li
>
<
div
class
=
"checkbox "
>
<
label
>
<
input
type
=
"checkbox"
value
=
""
>
@item.ProductCategoryName
</
label
>
@if (item.productCategory.Count
>
0)
{
@Html.Partial("_productOffered", item)
}
</
div
>
</
li
>
}
</
ul
>
}
And this table structure. I want to show 0 idparentcategoryproduct name at top heading by each seperated coloums like above image showing.
How can I manage foreach loop at View page?
Please help me...
Reply
Answers (
3
)
Onclick Button hide row forever in GridView ASP.NET
'Oracle.DataAccess.Client.OracleCon threw an exception.