Accessing values of dynamically added controls on Postback

Discussion in 'ASP .Net' started by =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Jul 14, 2005.

  1. Hi,

    I have added some textbox dynamically and now trying to retrieve the values
    posted on a 'save' event.

    when I try the following lines I get 'Object reference not set to an
    instance of an object.....'

    foreach(Control c in Parent.Controls) <--- line where I'm getting this
    {
    Response.Write ("<BR>" + c.GetType().ToString());
    }

    Any help?????
    =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Jul 14, 2005
    #1
    1. Advertising

  2. You have to re-create dynamically created controls on every postback.

    Eliyahu

    "dotnettester" <> wrote in message
    news:...
    > Hi,
    >
    > I have added some textbox dynamically and now trying to retrieve the

    values
    > posted on a 'save' event.
    >
    > when I try the following lines I get 'Object reference not set to an
    > instance of an object.....'
    >
    > foreach(Control c in Parent.Controls) <--- line where I'm getting this
    > {
    > Response.Write ("<BR>" + c.GetType().ToString());
    > }
    >
    > Any help?????
    Eliyahu Goldin, Jul 14, 2005
    #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. NotYetaNurd
    Replies:
    1
    Views:
    448
    John Saunders
    Nov 7, 2003
  2. Matthew Smith

    Dynamically added controls and postback

    Matthew Smith, May 16, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    507
    =?Utf-8?B?Q2hyaXM=?=
    May 16, 2004
  3. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: Dynamically added controls and postback

    Phil Winstanley [Microsoft MVP ASP.NET], May 16, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    Phil Winstanley [Microsoft MVP ASP.NET]
    May 16, 2004
  4. Ryu
    Replies:
    1
    Views:
    3,209
    Lucas Tam
    Aug 18, 2004
  5. William Manring

    Accessing Dynamically added controls after postback

    William Manring, Jun 26, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    140
    Tim Boland
    Jun 26, 2003
Loading...

Share This Page