Database driven Menu

Posted by Naeem2049 under ASP.NET on 12/28/2010 | Points: 10 | Views : 2406 | Status : [Member] | Replies : 4
i have static menu using UL tags and their associated CSS styles.
i want to convert that menu dynamic that the data comes from database as i have categeory head and sub categeries.
categeory head display in 1st level nd sub categeories display in 2nd level.

so how can i convert this..

plz help?




Responses

Posted by: SheoNarayan on: 12/28/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Did you try retrieving your categories and subcategories from database and looping them and contcatenating them based on the order it should appear (ul, li) and then setting the lieteral control (you need to place a asp:Literal control on the page) of the page to the string that you get after contactenation?

Make sure that you are contcatenating your strings using StringBuilder not string +=. This will speed up your performance of the page.

Alternatively, you can use asp:Menu control and set RenderingMode="List" (asp.net 4.o only) that will render your menu in ul, li format. In this case you will have to make sure that your data is coming from database in proper order. Read more about asp:Menu control at http://www.dotnetfunda.com/tutorials/controls/menu.aspx

Thanks!



Regards,
Sheo Narayan
http://www.dotnetfunda.com

Naeem2049, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naeem2049 on: 12/29/2010 [Member] Starter | Points: 25

Up
0
Down

Hi, Sheo Narayan

I will try to follow your link and suggestions on this

Thanks



Naeem2049, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chvrsri on: 12/30/2010 [Member] [Moderator] [MVP] Silver | Points: 25

Up
0
Down

Hi Naeem,

Apart from regular Asp menus there are a lot of third party menus available which has greater look and feel and can handle event pretty easily, But they charge for some of the controls .

Thanks,
Radha Srikanth

Naeem2049, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naeem2049 on: 1/1/2011 [Member] Starter | Points: 25

Up
0
Down

Hi CH.V.RADHA SRIKANTH ,

My requirement is only to understand how can we control or menus dynamically from SQL database.

I have done the static menu but not sure how to apply this dynamically through database.

Please refer some useful links for essay and better understandings.

Thanks in advance for help....

Regards
NAEEM

Naeem2049, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response