473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Get data from IEnumerable. Loop.

Hello,

I found really useful Hierarchy extension (http://www.scip.be/
index.php?Page=ArticlesNET18) which I am using to load the categories
hierarchic structure from an Adjacency Model table.

So with my Linq query I get an object of type
IEnumerable<HierarchyNode<MyType>>

The result can be used as a ItemSource of an Asp.Net tree view but
this is not what I need.

I am trying to create two things:

1. Create a SelectList.

Each item has a name and a value:
value = MyType.ID
name = N nbsp; + MyType.Name
(N nbsp; are added before the name. N = Node Depth
which is given in each Hierarchy Node)

2. Create a Unordered List (Just a string containing the code). Just
an example of how it would look:

<ul id="Categories">
<li>Root 1</span>
<ul>
<li>Child 11
<ul>
<li>Child 111</li>
<li>Child 112</li>
</ul>
</li>
<li>Child 12</li>
</ul>
</li>
<li>Root 2
<ul>
<li>Child 21</li>
</ul>
</li>
</ul>

Could someone, please, help me out in creating this loops?

Thanks,
Miguel
Jun 27 '08 #1
0 924

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gordon Rundle | last post by:
It drives me nuts that I can't use foreach with an enumerator instance. I would like the following to be functionally identical: foreach (Object o in MyCollection) ... foreach (Object o in...
3
by: Oliver Gargour | last post by:
Is at all possible to get IEnumerable Item Count without having to loop through using GetEnumerator() ?? Thanks
5
by: Tin Gherdanarra | last post by:
Dear mpdls, here is a simple example of an IEnumerable that generates integers: It works, but I have only a vague idea of what's going on. I understand that /yield/ wraps the humble integer...
1
by: =?Utf-8?B?RnJhbmNvaXNWaWxqb2Vu?= | last post by:
Hi there, Does anybody know how to return the results of an IEnumerable<typeas an array of the same type i.e type in a web service call without first having to collect all elements in the...
2
by: Steve Richter | last post by:
very confused on how to implement the IEnumerable and IEnumerator interfaces on a generic type. I understand I should just use a foreach loop in the GetEnumerator method and use "yield return",...
8
by: David | last post by:
Hi all, Using C# 1.1 I have a dataset loaded from an XML file. The idea being that if the app (a winform app that relies on a webservice) is offline, then I save data locally in XML and...
2
by: =?Utf-8?B?a2VubmV0aEBub3NwYW0ubm9zcGFt?= | last post by:
When creating multiple iterators, the original is defined as returning IEnumerator, ie public IEnumerator GetEnumerator() { yield x; ...} whereas the additional ones are defined as returning...
2
by: Ronald S. Cook | last post by:
Does anyone know how to convert an object of type IEnumerable to a DataTable? Thanks, Ron
4
by: jmDesktop | last post by:
In the code below from MSDN How do the PeopleEnum methods ever get called? foreach (Person p in peopleList) Console.WriteLine(p.firstName + " " + p.lastName); What is going on behind the...
9
by: K Viltersten | last post by:
At this point, i usually use a foreach-loop to run through all the XElement's in my IEnumerable<XElement>. I noticed, i'd like to address the elements using brackets and an index (or like a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.