473,788 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 inheritscollect ion 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>35anIGTvBEu BTMJwHxfMOA==</Id>
Nov 18 '05 #1
2 1501
Prakash C via .NET 247 <an*******@dotn et247.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*******@dotn et247.com> wrote in message
news:u7******** ******@TK2MSFTN GP09.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>35anIGTvBEu BTMJwHxfMOA==</Id>
Nov 18 '05 #3

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

Similar topics

1
2286
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 so on. (The structure is a GoF Composite.) If I call the CollectionBase.Clear method on the root object, will it release all child and grandchild objects for garbage collection, or will it release only the root-level children. In other words,...
0
923
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 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 ->...
2
2133
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 function. My objects aren't null, my ItemDataBound() method is being called, and as you can see I have verified that I have data. Yet, the repeater does not appear in the final HTML, and what's more, after
3
1762
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) with a nested Class(Questions) inside of it and a Collection of that Class(Steps) and it works fine, but the Nested Collection(Questions) is escaping me. Help!
5
1335
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) with a nested Class(Questions) inside of it and a Collection of that Class(Steps) and it works fine, but the Nested Collection(Questions) is escaping me. Help!
2
1417
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 http://aspalliance.com/721 that describes making classes for the Student and the StudentList, but I'm wondering how to make classes that are collections of the other classes, ie a ClassList that holds the StudentList class and a TeacherList class that...
0
996
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 to 100. But i experienced that in IE 6.0 (which i am using) when i created and run the asp.net application which does the above said thing, it shows only nested table up to 26 LEVELs only. If i need more levels of TABLE Controls in IE - WHAT...
0
1470
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 level. and N can be anything positive integer up to 100. But i experienced that in IE 6.0 (which i am using) when i created and run the asp.net application which does the above said thing, it shows only nested table up to 26 LEVELs only.
1
2253
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 not the charts. Am I missing something? can you serialize to this depth without extra code? or do I need to call the serialize method of the child objects? clsReports.SerializeObject("c:\report.xml", m_AllReports) '"m_AllReports" contains the...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10112
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.