Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try something like this .</p> <p>This is just example how you bind data to the menu control using asp.net.. you can bind list also same way like this....</p> <p>Start with a IHierarcyData class that will store each string from the StringCollection...</p> <pre><code>public class MyMenuItem : IHierarchyData { public MyMenuItem(string s) { Item = s; } public override string ToString() { return Item.ToString(); } #region IHierarchyData Members public IHierarchicalEnumerable GetChildren() { return null; } public IHierarchyData GetParent() { return null; } public bool HasChildren { get { return false; } } public object Item { get; set; } public string Path { get { return string.Empty; } } public string Type { get { return string.Empty; } } #endregion } </code></pre> <p>Build a class that will be the collection...</p> <pre><code>public class MyMenu : StringCollection, IHierarchicalEnumerable { List&lt;IHierarchyData&gt; _list = new List&lt;IHierarchyData&gt;(); public void Add(StringCollection strings) { foreach (string s in strings) { MyMenuItem i = new MyMenuItem(s); _list.Add(i); } } #region IHierarchicalEnumerable Members public IHierarchyData GetHierarchyData(object enumeratedItem) { return enumeratedItem as IHierarchyData; } #endregion #region IEnumerable Members public System.Collections.IEnumerator GetEnumerator() { return _list.GetEnumerator(); } #endregion } </code></pre> <p>In the page you can now construct the menu...</p> <pre><code> MyMenu pos = new MyMenu(); StringCollection sc = new StringCollection(); sc.Add("First"); sc.Add("Second"); pos.Add(sc); Menu1.DataSource = pos; Menu1.DataBind(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload