473,387 Members | 1,534 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.

XML driven Menu control generation

Anyone have idea how to build a configurable menu control. The menu items must be read from XML or from the database & the items must be built. Options must be provided for generating horizontal or vertical menu. Any idea would be helpful.
Aug 27 '08 #1
2 2470
On Aug 27, 10:14*am, Sathish Kumar wrote:
Anyone have idea how to build a configurable menu control. The menu itemsmust be read from XML or from the database & the items must be built. Options must be provided for generating horizontal or vertical menu. Any idea would be helpful.
Hi,

Of course, it's simple in fact.
declare your XML file, the horizontal/vertical can be an attribute of
the top tag.
then each subitem is a menu entry, basically all you need is the text,
and the action. The action part is the tricky one though. What I did
(it was for a toolbar but must be the same) is define an
interface ,IToolbarCommand with one method Execute() . in the Tag
property of the menu item you store the name of the class that takes
care of that action, then when selected you instantiate that class,
cast it to your interface and execute it.

Hope to be clear enough, if not post back and I will post some code
Aug 27 '08 #2
The action part is the tricky one though. What I did
(it was for a toolbar but must be the same) is define an
interface ,IToolbarCommand with one method Execute() . in the Tag
property of the menu item you store the name of the class that takes
care of that action, then when selected you instantiate that class,
cast it to your interface and execute it.

If every toolbar button has corresponding menu item then this can
simplified.

Store corresponding menu item name to Toolbar button Tag property.
In Toolbar button common click event loop over all menu items, find
corresponding menu item and execute PerformClick() for this menu item.

Andrus.

Aug 27 '08 #3

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

Similar topics

2
by: alanrn | last post by:
For all you seasoned VB programmers this is going to be a no brainer. However, as a C programmer learning VB I'm having trouble getting my arms around the event-driven nature of VB. Suppose I...
2
by: vikram | last post by:
I have to design a page which contains a dynamic generated menu at left side.Menu will be generated once a user log in and will remain as it is for the rest of the user session. Problem is that...
0
by: technology_post | last post by:
Sybase Releases DataWindow .NET 2.0, Taking Data-Driven Applications from Complex to Virtually Code-Less Application Development Tool Delivers Support for the Microsoft .NET Framework 2.0 ...
2
by: Mark Rae | last post by:
Hi, I'm interested in what people think of the new <asp:Menu> control in comparison to other 3rd-party menu controls. E.g. until v2, I used the AITOC FlexMenu...
2
by: dorrit.Riemenschneider | last post by:
Hi, I develop a sharepoint webpart with ASP.Net 2.0 and therefore override CreateChildControls(). In CreateChildControls() I create dynamically a menu with items (and sub items) from a database....
11
by: JJ | last post by:
I want to create a web site with the page content being driven by my sql database. This would form the basis of a simple content management system. i.e. a particular page may be accessed by the...
3
by: =?Utf-8?B?ZWFndWlsYXI=?= | last post by:
Hi, I am trying to dynamically generate a menu, based on entries on a text or xml file. The text file contains the "tree" after which the menu will need to be created. Something like the...
0
by: Sathish Kumar | last post by:
Anyone have idea how to build a configurable menu control. The menu items must be read from XML or from the database & the items must be built. Options must be provided for generating horizontal or...
25
by: pereges | last post by:
Hello, I'm trying to build a database driven website for a library management system. The database is stored on a remote server which all of my team mates can access. I've installed MySQL, PHP and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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.