ASP:menu control question
-
Dear All, I would like to implement a horizontal drop down menu in asp.net ..but would like the use the in built menu control so that I will not use javascript. However, I would like to be able to set a different style for each header in the menu. For example the home category may have a green border and some other html, the products category may have a blue border along with some html etc. What I need is to actually make a template for each of the categories. Is this possible with the build in control? Any tips that might put me on the right track? Thanks a lot, Chris
-
Dear All, I would like to implement a horizontal drop down menu in asp.net ..but would like the use the in built menu control so that I will not use javascript. However, I would like to be able to set a different style for each header in the menu. For example the home category may have a green border and some other html, the products category may have a blue border along with some html etc. What I need is to actually make a template for each of the categories. Is this possible with the build in control? Any tips that might put me on the right track? Thanks a lot, Chris
-
Dear All, I would like to implement a horizontal drop down menu in asp.net ..but would like the use the in built menu control so that I will not use javascript. However, I would like to be able to set a different style for each header in the menu. For example the home category may have a green border and some other html, the products category may have a blue border along with some html etc. What I need is to actually make a template for each of the categories. Is this possible with the build in control? Any tips that might put me on the right track? Thanks a lot, Chris
Hi Chris, It sounds like you're going to be best served by looking into CSS Adapters, which allow you to override the rendering of ASP.NET controls. Scott Guthrie has a good overview [^] that may help you get started. Microsoft has also released some reference adapters[^] and a toolkit [^] that may prove helpful. A google[^] search for ASP.NET CSS Adapters will net you lots of hits. Hope that helps. :)
--Jesse
"... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
-
Dear All, I would like to implement a horizontal drop down menu in asp.net ..but would like the use the in built menu control so that I will not use javascript. However, I would like to be able to set a different style for each header in the menu. For example the home category may have a green border and some other html, the products category may have a blue border along with some html etc. What I need is to actually make a template for each of the categories. Is this possible with the build in control? Any tips that might put me on the right track? Thanks a lot, Chris
The asp.net menu control has a
MenuItemDataBound
event which allows you to access each menu item as the menu is being databound. As this event triggers you can modify the properties of the menu item as you require.protected void MainMenu_MenuItemDataBound(object sender, MenuEventArgs e)
{
MenuItem mi = e.Item;
mi.Text = .... do stuff here ...
}Declan Bright www.declanbright.com