Build C# menu system

  • Thread starter Thread starter hon123456
  • Start date Start date
H

hon123456

Dear all,

I want to write a c# web page to change the menu
displayed
in the main page.


What I want is I can Add,delete or modify the main menu, add, delete
or modify submenu. Or change the menu. Now the menu is generated with
web.sitemap file. So I want to write the menu
system based on web.sitemap. But I would also like to have other
method, for example, by text or
by database. The main purpose is that I can edit menu, add menu and
sub menu or change it.


Please reply me on where I can download any sample code. Or would u
please give me some advice or details on how to implement it.


thanks
 
Dear all,

            I want to write a c# web page to change the menu
displayed
in the main page.

What I want is I can Add,delete or modify the main menu, add, delete
or modify submenu. Or change the menu. Now the menu is generated with
web.sitemap file. So I want to write the menu
system based on web.sitemap. But I would also like to have other
method, for example, by text or
by database. The main purpose is that I can edit menu, add menu and
sub menu or change it.

Please reply me on where I can download any sample code. Or would u
please give me some advice or details on how to implement it.

thanks

You might want to look at the following examples:

http://bytes.com/topic/asp-net/answers/588926-editing-web-sitemap-programatically
http://harriyott.com/2007/03/adding-dynamic-nodes-to-aspnet-site.aspx
 
What I want is I can Add,delete or modify the main menu, add, delete
or modify submenu. Or change the menu. Now the menu is generated with
web.sitemap file. So I want to write the menu
system based on web.sitemap. But I would also like to have other
method, for example, by text or
by database. The main purpose is that I can edit menu, add menu and
sub menu or change it.

Before going forward, the question is WHY? Why do you need a dynamic
menu?

If it is because different users, based on authentication, see different
items, then use security trimmings rather than dynamically dink with the
menu. You can set up each node to correspond to certain roles and by
setting security trimmings to true, you can have it respect.

An even better option is to put the secure pages in their own folder,
with a locked down web.config. The system automatically respects these
settings, and it is, imo, more maintainable than constantly whacking the
sitemap, as you are working in isolation with the secured pages.

If this is not why you are doing this, then other answers might apply.
My personal choice for a truly dynamic menu would be move away from
sitemap and use a database with a custom sitemap provider.

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top