Creating controls at runtime

Discussion in 'ASP .Net' started by Bart Schelkens, Sep 29, 2004.

  1. Hi,

    i have a label on my webpage.
    I want to create some copys of this label at runtime, since i don't know how
    many labels i will be needing.

    How can i do this?

    Thx
     
    Bart Schelkens, Sep 29, 2004
    #1
    1. Advertisements

  2. Bart Schelkens

    Lucas Tam Guest

    "Bart Schelkens" <> wrote in
    news::

    > i have a label on my webpage.
    > I want to create some copys of this label at runtime, since i don't
    > know how many labels i will be needing.
    >
    > How can i do this?




    Dim newLabel as Label()

    For i = 0 as integer to NumLabel
    newLabel = new Label()
    PlaceHolder.controls.add(newLabel)
    Next

    PlaceHolder is a placeholder on your page

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Sep 29, 2004
    #2
    1. Advertisements

  3. And if I was to buttons this way, how would I write the onclick-event of
    those buttons ?

    "Lucas Tam" <> wrote in message
    news:Xns9573372651FEFnntprogerscom@140.99.99.130...
    > "Bart Schelkens" <> wrote in
    > news::
    >
    > > i have a label on my webpage.
    > > I want to create some copys of this label at runtime, since i don't
    > > know how many labels i will be needing.
    > >
    > > How can i do this?

    >
    >
    >
    > Dim newLabel as Label()
    >
    > For i = 0 as integer to NumLabel
    > newLabel = new Label()
    > PlaceHolder.controls.add(newLabel)
    > Next
    >
    > PlaceHolder is a placeholder on your page
    >
    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
     
    Bart Schelkens, Sep 29, 2004
    #3
  4. Bart Schelkens

    Lucas Tam Guest

    Lucas Tam, Sep 29, 2004
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeremy Chapman

    Creating TemplateColumns for a grid at runtime

    Jeremy Chapman, Jul 25, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    571
    Justin Dutoit
    Jul 26, 2003
  2. Varangian
    Replies:
    7
    Views:
    774
    Varangian
    Apr 27, 2006
  3. Hal Vaughan
    Replies:
    11
    Views:
    1,530
    Gordon Beaton
    May 22, 2006
  4. Tarscher
    Replies:
    9
    Views:
    579
    Russell
    Feb 13, 2007
  5. Replies:
    2
    Views:
    447
    Scott McPhillips [MVP]
    Nov 7, 2005
  6. Nathan Sokalski
    Replies:
    4
    Views:
    1,396
    Muhammad Naveed Yaseen
    Sep 5, 2007
  7. geronimo

    Creating controls at runtime

    geronimo, Jul 22, 2003, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    317
    geronimo
    Jul 22, 2003
  8. Mike Towle

    Dynamically Creating Controls at Runtime

    Mike Towle, Apr 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    265
    Alvin Bruney [MVP]
    Apr 16, 2004
Loading...