How do you get dynamically created controls not to

Results 1 to 2 of 2

Thread: How do you get dynamically created controls not to

  1. #1
    Join Date
    Dec 1969

    Default How do you get dynamically created controls not to

    I have a aspx page that queries the database based upon a users input. Based upon the recordset returned, rows, cells, and texboxes are dynamically created within an a table. After these elements are displayed on the screen and the user does another postback, all of the dynamically created elements disappear. How do I prevent the diappearance of the elements? and how do I assign a server side procedure to execute on a dynamically created textbox&#039;s onTextChange event?<BR>Heres the sequence of events:<BR>1) Page is loaded and sent to client with a drop down list and an empty table ( id is tblMetrics)<BR>2) User selects a value from drop down list and a postback is performed.<BR>3) Server queries database and adds rows, cells, and textboxes to tblMetrics based upon dataset.<BR>4) Page is sent back to client with dyanmically created rows, cells, and textboxes.<BR>5) User performs a postback just to see if the dynamically created elements will exist when the page returns from the server.<BR>6) The routine on the server that added rows to the table is NOT called because it is assumed that the dynamically created rows, cells, and textboxes will continue to exist until programatically erased.<BR>7) The asp page that gets sent back to the client no longer has any of the dynamically created elements.<BR><BR>Thanks in advance for any advice!

  2. #2
    Join Date
    Dec 1969

    Default RE: How do you get dynamically created controls no

    Try making your table a global variable declared at the top of the code-behind page. This way it should persist and be visible in the code-behind and html pages.<BR><BR>Ive done a similar page by using placeholders. These act like wrappers for the normal ASP.NET controls - you just add textboxs etc.. and add literals for outputting HTML directly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts