Dynamically Added TextBoxes

Discussion in 'ASP .Net Building Controls' started by KJ, Dec 3, 2003.

  1. KJ

    KJ Guest

    Is there anyway to get the value of a dynamically added textbox that
    was added after OnInit in Page_Load on Postback?


    Page_Load

    Dim tb As New Textbox

    page.controls.add(tb)
    tb.text = "ASP.NET"
    End Sub


    But1_Click

    label1.text = tb.text


    End Sub


    My problem is tb.text is blank ("")

    Is there anyway to save the value between postback?

    Thanks
    KJ, Dec 3, 2003
    #1
    1. Advertising

  2. KJ

    Kishor Guest

    Hi KJ,

    one way to do this is to save the value in the textbox into the viewstate.

    kishor.

    "KJ" <> wrote in message
    news:...
    > Is there anyway to get the value of a dynamically added textbox that
    > was added after OnInit in Page_Load on Postback?
    >
    >
    > Page_Load
    >
    > Dim tb As New Textbox
    >
    > page.controls.add(tb)
    > tb.text = "ASP.NET"
    > End Sub
    >
    >
    > But1_Click
    >
    > label1.text = tb.text
    >
    >
    > End Sub
    >
    >
    > My problem is tb.text is blank ("")
    >
    > Is there anyway to save the value between postback?
    >
    > Thanks
    Kishor, Dec 5, 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. Forconi Boris via .NET 247

    TextBoxes created dynamically : How to store data?

    Forconi Boris via .NET 247, Jun 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    380
    Trevor Benedict R
    Jun 18, 2004
  2. Tony
    Replies:
    5
    Views:
    373
    Jeff Louie
    Jun 27, 2004
  3. Bennett Haselton
    Replies:
    1
    Views:
    514
    John M Deal
    Nov 8, 2004
  4. Jeffrey Todd
    Replies:
    1
    Views:
    4,105
    Peter Blum
    Jun 2, 2005
  5. Replies:
    0
    Views:
    351
Loading...

Share This Page