473,420 Members | 4,511 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,420 software developers and data experts.

Help to create a xml menu using asp.net c#

Hi.
I have this xml file:
<menu>
<header caption="File">
<item header="File" caption="New File"></item>
<item header="File" caption="Open File"></item>
<item header="File" caption="Close File"></item>
<item header="File" caption="New Web Site"></item>
<item header="File" caption="New Project"></item>
</header>
<header caption="Edit">
<item header="Edit" caption="Undo"></item>
<item header="Edit" caption="Redo"></item>
<item header="Edit" caption="Cut"></item>
<item header="Edit" caption="Copy"></item>
</header>
</menu>

I need to render this xml file like a menu using the followin code:
Get the headers on Page_Load()
Table tb = new Table();
TableRow tr = new TableRow();
foreach (XmlNode header in headerList)
{
TableCell tc = new TableCell();
tc.BorderWidth = Unit.Pixel(1);
tc.Attributes.Add("style", "width: 100px");
tc.Attributes.Add("columnID", tcID.ToString());
LinkButton lbt = new LinkButton();
lbt.Text = header.Attributes["caption"].Value.ToString();
lbt.Click += new EventHandler(MenuHeaderClick);
tc.Controls.Add(lbt);
tr.Cells.Add(tc);
}
tb.Rows.Add(tr);
placeholder.controls.add(tb)

And, whith the match header, I get the itens:
public MenuHeaderClick()
{
Table tb = new Table();
TableRow tr = new TableRow();
foreach (XmlNode item in itemList)
{
if (item.Attributes["header"].Value.ToString() == header)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
tc.Attributes.Add("style", "width: 100px");
tc.Attributes.Add("columnID", tcID.ToString());

LinkButton lbt = new LinkButton();
lbt.Text = item.Attributes["caption"].Value.ToString();
tc.Controls.Add(lbt);
tc.Controls.Add(new LinkButton());
tr.Cells.Add(tc);
tb.Rows.Add(tr);
}
}
placeholder.controls.add(tb)
}

The problem is, with this code my page render the menu like this:
File Edit
Undo
Redo
Cut
Copy

Well, I want the Edit menu itens above Edit, not above File, understand!
The problem is the logic to render the html table. I can't write the right
code!

Please, some body help me!

Thanks

Nov 18 '05 #1
0 2170

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

Similar topics

1
by: Tim Marshall | last post by:
I'm putting together my first help file (using Easy Help, http://www.easyhelp.com/). So far, so good. I'm able to use the Help File and Help Context ID to have things from my help file pop up...
15
by: Buck Rogers | last post by:
Hi guys! Task 1: Write a program which presents a menu with 5 options. The 5th option quits the program. Each option should execute a system command using system(). Below is my humble...
10
by: One Handed Man [ OHM ] | last post by:
If this is duplicated, I'm sorry because I cant find the original post I made today Anyway . . Now its my turn to ask a question I want to develop an app which will run in the system tray....
2
by: Merdelus | last post by:
I'm a new visual basic learner, I need some help with this program below: create an application that either sums or averagethe rows or columns of a two dimensional array depending on user...
4
by: Fred Flintstone | last post by:
This one baffles me. I'm using VS.Net 2005 and write desktop apps that need built in help. So logically, I figure maybe VS has a help system component built in so I search the help. Hey! ...
2
by: ishtar2020 | last post by:
Hi everybody I'd appreciate some help on creating a tear off menu with TkInter. I've been reading some documentation but still no luck. Please don't get confused: when I mean "tear off" menu I...
2
by: -D- | last post by:
I'm taking my first stab at using xml, so please bear with my novice questions and understanding of xml. I'm trying to create an xml file that holds all my website navigation. If I understand...
1
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
4
by: Edward K. Ream | last post by:
Hello all, Creating a 'Help' menu 'by hand' on the Mac does not work, or rather, it creates a *second* Help menu. There are hints about how to do this at:
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
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.