Creating A Menu From The Server Side
Solution 1:
You may want to look at micro-templating, where you create a template that uses json as it's data source. This way you can control the menu items with a database query, xml, whatever. The template is a nice feature as you will not have to rebuild and re-deploy should you want to change the look and feel. There are several asp.net examples:
Solution 2:
Its very easy, lots of ways to do it, but basically you asp.net vb code is outputting HTML and/or even some JavaScript lots of ways to do it, simplistically:
Response.Write("<divclass='mymenu'>")
Response.Write("<ul>")
Response.Write("<li>Menu Item 1</li>")
Response.Write("<li>Menu Item 2</li>")
Response.Write("<li>Menu Item 3</li>")
Response.Write("<li>Menu Item 4</li>")
Response.Write("</ul>")
Response.Write("</div>")
Obviously those menu items could come out of a database, or anyplace else. The sample code is not the only way to do it, and not even necessarily the best way, there are lots and lots of ways...but not only is it possible to do what you ask, it is very common and easy to do as well.
The javascript could also be written the to client the same way, but assuming it is static, you could just do it the regular way, i.e. in the markup.
Post a Comment for "Creating A Menu From The Server Side"