I have created a customer c# DropDownList control that can render out it's contents are optgroups (Not from scratch, I edited some code found on the internet, although I do understand exactly what it's doing), and it works fine.
However, I have now come across a situation where I need to have two levels of indentation in my dropdown, i.e.
<select>
<optgroup label="Level One">
<option> A.1 </option>
<optgroup label="Level Two">
<option> A.B.1 </option>
</optgroup>
<option> A.2 </option>
</optgroup>
</select>
However, in the example snippet above, it is rendering as if Level Two
was at the same amount of indentation as Level One
.
Is there a way to produce the nested optgroup behavior I am looking for?
This is just fine but if you add option which is not in optgroup it gets buggy.
Would be much better if you used css and close optgroup right away :