Accessing children information at parent level?

Jan 25, 2013 at 10:13 PM
Edited Jan 25, 2013 at 10:19 PM

Great helper! Thanks

I have set up the following razor code to make a big hierarchal tri-state select list:

.EmptyContent("No Products or Services have been found!")
.Children(m => m.Children)
.HtmlAttributes(new { id = "PSHierarchy", @class = "pns" })
.ChildrenHtmlAttributes(new { @class = "subItem" })
.ItemText(m => m.Description)
<span "i@(item.Code)" data-value="@item.Code" data-Group="@item.Category" class="pm in transparent"> + </span>
<span "e@(item.Code)" data-value="@item.Code" data-Group="@item.Category" class="pm ex transparent"> - </span>
@if (item.ServiceLevel != 0)//All none root elements
<span id="d@(item.Code)" class="pm display">@item.Description </span>
<span id="d@(item.Code)" class="pm display bold"><b>@item.Description</b></span>
} </text>) )
I am using jquery to add + or subtract -  selected items to one of two hidden selectlists. This works great except that I need to add all of the child items under a parent if the parent is clicked.
Is it possible to somehow get access to all of the child items at the parent level? I'm a little confused as to what the .Children property does and/or can be used for.