Groups | Blog | Home
all groups > asp.net > february 2006 >

asp.net : Dynamic Menu


aroraamit81 NO[at]SPAM gmail.com
2/16/2006 11:07:04 PM
Is there any way by which I can create a dynamic database driven Menu
using ASP.NET/C#......

Thanks
Amit Arora
Edwin Knoppert
2/17/2006 12:00:00 AM
About every control can be populated from code like from the page_load.


<aroraamit81@gmail.com> schreef in bericht
news:1140160024.153426.68350@g43g2000cwa.googlegroups.com...
[quoted text, click to view]

Kris
2/17/2006 1:50:04 AM
Hi Amit,

I did create a left navigation menu in my web page using below code.

While (reader.Read())
Dim navLink As New HtmlHyperLink
navLink.Text = reader.GetString("Text");
navLink.Url = reader.GetString("URL");
AddRow(navLink)
If index < (years.Count - 1) Then
AddRow(New LiteralControl("&nbsp;"))
End If
End While


Private Sub AddRow(ByRef control As Control)
Dim row As New System.Web.UI.HtmlControls.HtmlTableRow
Dim cell As New System.Web.UI.HtmlControls.HtmlTableCell

If Not control Is Nothing Then
cell.Controls.Add(control)
End If
row.Cells.Add(cell)
tblLinks.Rows.Add(row)
End Sub

Cheers,
Kris
aroraamit81 NO[at]SPAM gmail.com
2/17/2006 3:50:39 AM
Thanks Mate.....
But i guess u took me wrong...
I mean the menu, kind of comes horizontally on which mouseover,
mouseout etc. events gets fired.
I guess u have understood my requirement.
Any suggesion???..

Thanks,
Amit Arora
Kris
2/17/2006 4:21:11 AM
Hi Amit,

Yes. You can do this very well. Create a custom control which outputs
HTML text, and add onMouseOver, onMouseOut client events to display or
hide the tables accordingly. Handle these events with the help of
Javascript and CSS.

Once I did similar kind of dynamic menu generation with the help of XML
and Vb.Net.

Cheers,
Kris
DWS
2/17/2006 8:46:18 AM
Horizontal with asp.net menu control you have to create seperate menus for
each column similar to how Kris built his but going across.


[quoted text, click to view]
Edwin Knoppert
2/17/2006 2:53:33 PM
On this site:

http://www.hellobasic.com/dotnet/imgmap1/default.aspx

I used the *ordinary* asp:Menu (for *this* specific example you'll need
MSIE, flaw in Opera).

It shows: File, Edit and Help with menus.


<aroraamit81@gmail.com> schreef in bericht
news:1140177039.892271.158700@g43g2000cwa.googlegroups.com...
[quoted text, click to view]

AddThis Social Bookmark Button