tags:

views:

17

answers:

1

Im creating a web application in asp.net visual studio 2008.. in my application, i have manually created a menu control.. since, the menus changes by needs, i wish to load it dynamically from sql table.. help me with simple application which loads a menu control dynamically and i can develop mine using those concepts....

thank u very much

+1  A: 

load your menu to a datatable. then create a repeater in your ascx page (i guess your menur is a user control) create the template for the repeater. bind the datatable as the datasource for that repeater. and there you go. a simple dynamic menu.

dont forget to do a cache on your control. or cache the datatable. so you wont open a connection to the database on every request for a page on your site

here is some examples for using a repeater :

http://articles.sitepoint.com/article/asp-net-repeater-control http://www.w3schools.com/aspnet/aspnet_repeater.asp http://www.asp101.com/articles/john/repeater/default.asp

guy schaller