I have a model Category that has ParentId relationship with itself. I have restricted my model to only two levels of parent-child relationship. In my input form, the user shall be allowed to select from either the parent or child that is shown in the select list.
Also as I anticipate the list to be fairly large, I only want to display the children, when the user hovers over the parent.
I have spent a lot of time playing around with bootstrap menu/sub-menu to achieve this. There is a sample that comes close: http://www.bootply.com/iKJV5sCSYU# , where I create an EditorTemplate for the Category List, but I can not get the sub-menu to show. Here is what I tried to add a submenu to the above code:
<div class="container">
<h2>Dropdown as Select</h2>
<div class="btn-group">
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">Select a Country <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Item I</a></li>
<li><a href="#">Item II</a></li>
<li><a href="#">Item III</a></li>
<li><a href="#">Item IV</a></li>
<li><a href="#">Item V</a></li>
<li class="dropdown-submenu">
<a href="#">More..</a>
<ul class="dropdown-menu">
<li><a href="#">2nd level</a></li>
<li><a href="#">3rd level</a></li>
</ul>
</li>
</ul>
</div>
</div>
Can someone please point out if what I am trying to achieve is possible through this approach, or if there is an alternative way of meeting my requirement.