Adding Controls Dynamically

Discussion in 'ASP .Net Web Controls' started by Prabhu Ram Prasath, Oct 29, 2003.

  1. Dear Friend,

    Does anyone could answer this simple problem!!!

    I have a textbox, submit button and a panel (all webserver
    controls) in a web page.

    After entering some text in the textbox and pressing the
    submit button, it will add the text into the panel as a
    Hyperlink.

    The code in the command button is
    newCtrl = New WebControls.HyperLink
    newCtrl.Text = textbox1.Text & "<BR>"
    newCtrl.ID = textbox1.Text
    panel1.Controls.Add(newCtrl)

    The procedure is running well, but the next time I press
    the button, the old hyperlink gets destroyed and only the
    new hyperlink gets displayed in the panel.

    Any Idea!!!

    Regards,
    Prabhu Ram Prasath
     
    Prabhu Ram Prasath, Oct 29, 2003
    #1
    1. Advertising

  2. Prabhu Ram Prasath

    Wesam Guest

    Probably the insertion happens by posting data (the newly inserted link) to
    the WEB server, and thus it is added; likewise when you add another one, the
    list (the panel) is emptied as if you'd started the application for the
    first time and thus you lose the old data and only see the new ones (the new
    link).

    We$am

    "Prabhu Ram Prasath" <> wrote in message
    news:08e701c39de7$c8a923c0$...
    > Dear Friend,
    >
    > Does anyone could answer this simple problem!!!
    >
    > I have a textbox, submit button and a panel (all webserver
    > controls) in a web page.
    >
    > After entering some text in the textbox and pressing the
    > submit button, it will add the text into the panel as a
    > Hyperlink.
    >
    > The code in the command button is
    > newCtrl = New WebControls.HyperLink
    > newCtrl.Text = textbox1.Text & "<BR>"
    > newCtrl.ID = textbox1.Text
    > panel1.Controls.Add(newCtrl)
    >
    > The procedure is running well, but the next time I press
    > the button, the old hyperlink gets destroyed and only the
    > new hyperlink gets displayed in the panel.
    >
    > Any Idea!!!
    >
    > Regards,
    > Prabhu Ram Prasath
     
    Wesam, Oct 29, 2003
    #2
    1. Advertising

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. John Wallace
    Replies:
    0
    Views:
    339
    John Wallace
    Aug 6, 2003
  2. MC D
    Replies:
    4
    Views:
    469
    Big D
    Nov 18, 2003
  3. Uzi Baruch
    Replies:
    0
    Views:
    441
    Uzi Baruch
    Dec 17, 2003
  4. ALPO

    Adding Controls Dynamically

    ALPO, Dec 31, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    360
  5. Greg
    Replies:
    1
    Views:
    349
Loading...

Share This Page