accessing dynamically created controls

Discussion in 'ASP .Net Web Controls' started by Sandra Castellanos, Jun 9, 2004.

  1. Hi,

    I have an <asp:table> inside an aspx page, and in the code I am adding
    several rows, cells and controls such as listboxes and radiobuttons to it.
    When I load the page, I see all the controls that have been created, but
    when I submit it, the table is empty again. What do I have to do to access
    the controls I created, with the values the user added to it?

    Regards,

    Sandra Castellanos
     
    Sandra Castellanos, Jun 9, 2004
    #1
    1. Advertising

  2. When you dymicly create controls you have to take care of that creation each
    time the postback happens. You have to know that page object istance doesn't
    persist on the server between postbacsk. YOu only have a feeling it does but
    it doesn't. that's why ViewState is used etc... The best way to do this is
    to have some properties that get set when a user changes the page. When a
    Postback happens in the PageLoad event recreate those controls that you
    need. View state will automaticly be restored to those controls that save
    it.

    --
    RobertK
    { Clever? No just smart. }


    "Sandra Castellanos" <> wrote in message
    news:...
    > Hi,
    >
    > I have an <asp:table> inside an aspx page, and in the code I am adding
    > several rows, cells and controls such as listboxes and radiobuttons to it.
    > When I load the page, I see all the controls that have been created, but
    > when I submit it, the table is empty again. What do I have to do to access
    > the controls I created, with the values the user added to it?
    >
    > Regards,
    >
    > Sandra Castellanos
    >
    >
     
    Robert Koritnik, Jun 10, 2004
    #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. Brian Smith
    Replies:
    4
    Views:
    716
    Brian Smith
    Jan 9, 2004
  2. R Duke
    Replies:
    2
    Views:
    4,647
    =?Utf-8?B?SG1udA==?=
    Apr 25, 2004
  3. Steve Black
    Replies:
    2
    Views:
    635
    Steve Black
    May 6, 2004
  4. msimmons
    Replies:
    0
    Views:
    489
    msimmons
    Jul 16, 2009
  5. Jim Mitchell

    Accessing OnClick event for dynamically created controls.

    Jim Mitchell, Aug 12, 2003, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    225
    Jim Mitchell
    Aug 13, 2003
Loading...

Share This Page