Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Creating Menu controls on the fly

Reply
Thread Tools

Creating Menu controls on the fly

 
 
ree32
Guest
Posts: n/a
 
      09-08-2004
I am reading off menu items from an XML file.

The problem I have is how to create these menu items into link buttons
on the fly. As the number of menu items will vary depending on the
contents of the xml file. So I cannot initialise these all these link
buttons one by one at start.

So I was wondering whether there was a way to dynamically create them?
 
Reply With Quote
 
 
 
 
Joerg Jooss
Guest
Posts: n/a
 
      09-08-2004
ree32 wrote:
> I am reading off menu items from an XML file.
>
> The problem I have is how to create these menu items into link buttons
> on the fly. As the number of menu items will vary depending on the
> contents of the xml file. So I cannot initialise these all these link
> buttons one by one at start.
>
> So I was wondering whether there was a way to dynamically create them?


If all you need are simple hyperlinks, you could use the Xml WebControl and
apply an XSLT transformation to create HTML directly from your XML source.

If you need to have server controls, you could write a composite control
that parses the XML file and creates a LinkButton for each entry of the XML
file in CreateChildControls(), but there are some tricky things to consider
when using the second approach. Do you need server controls?

Cheers,

--
Joerg Jooss
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
 
ree32
Guest
Posts: n/a
 
      09-08-2004
Server controls would be needed. As what I am trying to build
something similar to a tree structure menu. So I need menu items to
collapse depending on whether a toggle switch has been pressed.

I will go and and read more about composite controls to see if its
applicable to my case.


"Joerg Jooss" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...

> If you need to have server controls, you could write a composite control
> that parses the XML file and creates a LinkButton for each entry of the XML
> file in CreateChildControls(), but there are some tricky things to consider
> when using the second approach. Do you need server controls?
>
> Cheers,

 
Reply With Quote
 
Joerg Jooss
Guest
Posts: n/a
 
      09-09-2004
ree32 wrote:
> Server controls would be needed. As what I am trying to build
> something similar to a tree structure menu. So I need menu items to
> collapse depending on whether a toggle switch has been pressed.
>
> I will go and and read more about composite controls to see if its
> applicable to my case.


Composite controls are just a special breed of server controls. Instead of
creating markup language output in Render(), you create child server
controls in CreateChildControls(). A keypad composed of Button controls is a
good example.

Cheers,

--
Joerg Jooss
(E-Mail Removed)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
“test what you fly and fly what you test” Lawrence D'Oliveiro NZ Computing 0 06-05-2009 02:06 AM
THE FLY & THE FLY II teem DVD Video 0 12-10-2005 09:31 PM
Fly outmenu on the fly Brian Javascript 0 04-08-2005 01:34 AM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 7 11-06-2003 11:31 AM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 5 11-05-2003 06:23 AM



Advertisments