Dynamic Controls

Discussion in 'ASP .Net' started by Jim Heavey, May 11, 2004.

  1. Jim Heavey

    Jim Heavey Guest

    Hello, I have a web page with a <ASP:Table> control on the form. This
    table also has 5 DataListControls on 5 seperate <ASP:TableRow> controls.

    In code I am dynamically adding TableRow controls to this Table control.
    Depending on the content of the DataRows being added, I will set the
    appropriate DataListControls to be visible and set the DataSource.

    When The page is displayed on the Form Load, all is well, but when I hit
    the "Edit" button on one of the DataListControls, the page re-displays
    without running the the "OnItemCommand" event and that control show up as
    an empty row on my grid.

    I thought that since the DataListControls were on the form (maybe not in
    the correct poistion, but they were on the form), that the system would
    maintain state. I know that if I were to do a Page.Bind in the FormLoad
    method on the postback, that this would probably kill the event, and I have
    look closely and I have done no rebinding of any control, all I have done
    is place the "missing, but expected to be missing, Table Rows back into the
    Table control.

    SO I must have a hole in mu understanding of dynamic controls.

    Can someone clear up my misunderstanding???

    Your assistance is greatly appreciated!!!!
    Jim Heavey, May 11, 2004
    #1
    1. Advertising

  2. Jim Heavey

    Natty Gur Guest

    Hi,

    Dynamic create control should be create every time your page create.
    Usually creation of dynamic control happened in Form_load event. Load
    event called every time page request and it also the last place on the
    page life cycle where you can add event handlers to your dynamic
    controls. ViewState maintain data for controls and not maintain
    controls.

    HTH

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur, May 12, 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. =?Utf-8?B?VGVyb3M=?=

    Dynamic Variables? OR Dynamic Controls

    =?Utf-8?B?VGVyb3M=?=, Aug 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    419
    Scott Allen
    Aug 10, 2004
  2. Replies:
    5
    Views:
    5,578
  3. Ronald
    Replies:
    2
    Views:
    835
    Robbe Morris [C# MVP]
    Jan 17, 2006
  4. =?Utf-8?B?U3RldmUgRnVuaw==?=

    Dynamic Wizard with Dynamic Validation Controls

    =?Utf-8?B?U3RldmUgRnVuaw==?=, Oct 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    447
    =?Utf-8?B?U3RldmUgRnVuaw==?=
    Oct 13, 2006
  5. Denny Smolinski via .NET 247

    Dynamic Controls, Placeholder, Retrieve Information from Dynamic Controls

    Denny Smolinski via .NET 247, May 4, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    459
    Eidolon
    May 4, 2004
Loading...

Share This Page