need help generating a dynamic list control <ul />...

M

Milsnips

hi there,

i'm creating a dynamic menu system for a CMS website application. What i am
currently doing is the following: in a function called LoadMenu(), i loop
through the required db records and add the menus on the fly, however
because its not known which folder level the page will be on, i need to use
a <asp:hyperlink> control so i can use the navigateUrl="~/...."
functionality, whilst still programaticallly creating the <ul><li></li></ul>
tags.

I tried the following:

1. Using a Literal control - does not allow child controls.
2. Use a placeholder control - i can add the hyperlink but i dont know how
to add the relevant list tags.

If there is a way to add the "<ul>" tag from a server side control, eg. new
HTMLGenericControl, can anyone give me a quick example code?


Any help appreciated.
thanks,
Paul
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


|
| If there is a way to add the "<ul>" tag from a server side control, eg.
new
| HTMLGenericControl, can anyone give me a quick example code?
|

You could use a Repeater, take a look at MSDN for examples of how to use it,
in essence is very easy you just select the piece of code you want to
repeat, assign a data source and the repeater will do the rest.
 
M

Milsnips

hi there,

yeh i thought of this option, but because i'm grouping the menus by a field
called GroupID, on each new group, i need to create a new <ul></ul> tag and
place the menu items in there.

i think i've almost got it now using the placeHolder and GenericHTMLControl.

thanks,.
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top