c# - How to extend ListItem to be able to have childs inside BulletList -
Using asp.net c # I have a bullet list, and I would like to add list items that will be presented with the child.
Thanks
I'm not sure that BulletedList has a collection of ListItems. ListItems is generally used for form elements (thus selected, value, text properties) and can not be used for bulleted lists. There is no list for you to complete your goal, in which the child's lists are original. I would suggest using my classes to do this. Here's a quick mockup:
Public stable square bullet list {public static string RenderList (list & bullet list ITM & gt; list) {var sb = new StringBuilder (); If (list! = Null & amp; amp; index calculation & gt; 0) {sb.Append (""); Forex Currency (different items in the list) {sb.Append (item.Content); Sb.Append (BulletList.RenderList (item.Children)); } Sb.Append (""); } Return sb.ToString (); }} Public class BulletListItem {public string content {get; Set; } Public listing & lt; BulletListItem & gt; Children {receive; Set; }} Then you can create your list with children and output it ...
var items = new list & lt; BulletListItem & gt; (); item. Add (new bulletlist item () {content = "root 1"}); item. Add (new bullet list item) {content = "root 2", children = new list & amp; Bullet list item & gt; () {New bullet list item ({{content = "baby2}"}}); item. Add (new bulletlist item () {content = "root 3"}); Response.Write (BulletList.RenderList (item));
Comments
Post a Comment