Referencing value of a dynamically created control

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlrZQ==?=, Jul 13, 2004.

  1. I have a placeholder object in which I am dynamically placing controls based on a database query. Of course during postback these controls go away. I have seen other questions posed where someone wants the dynamically created controls to appear on the page. However in my case I don't really need to have the control displayed after postback, but I do need its value. When I look at the trace output from the page after postback, it lists the value of my dynamically created controls, but I cannot figure how to reference those values. Does anyone have any ideas?
     
    =?Utf-8?B?TWlrZQ==?=, Jul 13, 2004
    #1
    1. Advertising

  2. Mike <> typed:
    > I have a placeholder object in which I am dynamically placing
    > controls based on a database query. Of course during postback these
    > controls go away. I have seen other questions posed where someone
    > wants the dynamically created controls to appear on the page. However
    > in my case I don't really need to have the control displayed after
    > postback, but I do need its value. When I look at the trace output
    > from the page after postback, it lists the value of my dynamically
    > created controls, but I cannot figure how to reference those values.
    > Does anyone have any ideas?


    Mike I think the problem is always the same: you create the controls
    everytime the page is load and not only during the first load (the second
    one is the right way !).

    Try to do this:

    if(!IsPostBack)
    {
    //....first load....create or load controls
    }

    HTH
    --
    Davide Vernole
    MVP ASP/ASP.NET
    Microsoft Certified Solution Developer
     
    Davide Vernole [MVP], Jul 13, 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. Andy Fish
    Replies:
    0
    Views:
    311
    Andy Fish
    Nov 4, 2004
  2. Dica
    Replies:
    2
    Views:
    562
  3. msimmons
    Replies:
    0
    Views:
    498
    msimmons
    Jul 16, 2009
  4. Chris Kennedy

    Referencing Dynamically created controls

    Chris Kennedy, Apr 12, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    147
    ccallen
    Apr 12, 2004
  5. Leona Vo via .NET 247

    Referencing Dynamically Created Controls in PlaceHolder

    Leona Vo via .NET 247, Jun 11, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    126
    Leona Vo via .NET 247
    Jun 11, 2004
Loading...

Share This Page