473,387 Members | 1,650 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,387 software developers and data experts.

Problem with Nested Collections

Hi,

I am having a problem to create nested collections. I want tocreate a menu for my site. I created a MenuItem class which willstore the text that should appear on hyperlink. It may alsocontain other properties. Then a MenuItems class which inheritscollection base and implements ienumerator. The MenuItems classholds a collection of MenuItem objects.
Ok. Fine. Now, I will be having a nested menu, like Products ->Division -> Category -> Product. Likewise, I will be havingmenus of various levels for every top level menu, and within thesub menu i will have another sub menu, like that... I donno howto achieve it. Pls help me.

--------------------------------
From: Prakash C

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>35anIGTvBEuBTMJwHxfMOA==</Id>
Nov 18 '05 #1
2 1483
Prakash C via .NET 247 <an*******@dotnet247.com> typed:
Hi,

I am having a problem to create nested collections. I want to
create a menu for my site. I created a MenuItem class which will
store the text that should appear on hyperlink. It may also contain
other properties. Then a MenuItems class which inherits collection
base and implements ienumerator. The MenuItems class holds a
collection of MenuItem objects.
Ok. Fine. Now, I will be having a nested menu, like Products ->
Division -> Category -> Product. Likewise, I will be having menus of
various levels for every top level menu, and within the sub menu i
will have another sub menu, like that... I donno how to achieve it.


Simply add a property to your MenuItem object. This property must be a
MenuItems type. So you could obtain a n-level hierarchy inside at your
object. This mean that you have to implement a persistent method to save
data that it consider this nested hierarchy.

e.g.

MenuItem
|__MenuItems
|__MenuItem1
| |__MenuItems
| |_MenuItem11
|__MenuItem2
| |__MenuItems
|__......

HTH
--
Davide Vernole
MVP ASP/ASP.NET
Microsoft Certified Solution Developer
Nov 18 '05 #2
your MenuItems class should look like this..

MenuItems
-- Current
-- MenuItems
-- Length

MenuItems should be implemented as a collection like this.. MenuItems[0]
gives a reference to MenuItems.

hth,
Av.
"Prakash C via .NET 247" <an*******@dotnet247.com> wrote in message
news:u7**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am having a problem to create nested collections. I want to create a
menu for my site. I created a MenuItem class which will store the text that
should appear on hyperlink. It may also contain other properties. Then a
MenuItems class which inherits collection base and implements ienumerator.
The MenuItems class holds a collection of MenuItem objects.
Ok. Fine. Now, I will be having a nested menu, like Products -> Division ->
Category -> Product. Likewise, I will be having menus of various levels for
every top level menu, and within the sub menu i will have another sub menu,
like that... I donno how to achieve it. Pls help me.

--------------------------------
From: Prakash C

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>35anIGTvBEuBTMJwHxfMOA==</Id>
Nov 18 '05 #3

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

Similar topics

1
by: Dave Veeneman | last post by:
I have created a collection class derived from CollectionBase that can be nested several layers deep. so my root object has several child objects, each of which has several grandchild objects, and...
0
by: Prakash C via .NET 247 | last post by:
Hi, I am having a problem to create nested collections. I want tocreate a menu for my site. I created a MenuItem class which willstore the text that should appear on hyperlink. It may alsocontain...
2
by: Colin Nicholls | last post by:
Platform: ASP.NET 1.1 I have a repeater nested inside another repeater. My outer repeater is looping fine. I am manually binding the inner repeater to a DataReader obtained from another...
3
by: Atley | last post by:
I am trying to set up a nested collection so I can run statements like this me.lblquestions.text = mysteps.item(1).questions(1).Asked Any ideas on how to do this? I have created a Class(Steps)...
5
by: Atley | last post by:
I am trying to set up a nested collection so I can run statements like this: me.lblquestions.text = mysteps.item(1).questions(1).Asked Any ideas on how to do this? I have created a...
2
by: a | last post by:
The problem: I want to allow an administrator (user) to create a list of teachers, each teacher in turn has a list of classes, each class has a list of students. There's an article at...
0
by: Mahesh Devjibhai Dhola | last post by:
Hi, I dont know its good design or not but I have one REQUIREMENT that, I need nested tables (one table control into another table control) up to N level. and N can be anything positive integer up...
0
by: Mahesh Devjibhai Dhola | last post by:
Hi, I dont know its good design or not but I have one REQUIREMENT that, I have a Web application created in ASP.NET, and I need nested tables (one table control into another table control) up to N...
1
by: Rick Luckwell | last post by:
I have 3 collections(reports, services, charts) of objects(report, service, chart) that are nested with each other. When I serialize the object the output only contains reports and services but...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.