Preserving POSTBACK data on dynamically added textboxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rvdnieuwenhuizen@gmail.com

    #1

    Preserving POSTBACK data on dynamically added textboxes

    Hi,

    The problem I cannot seem to solve:

    I have a page with a button control. In the On_Click eventhandler I
    dynamically add one TextBox each time the button is clicked. I add the
    textboxes to an update panel. I store the ID for the generated
    textboxes in the Viewstate, which I use in the Panels' INIT
    eventhandler to go ahead and instantiate the textboxes once again
    every postback. I use the, in my opinion, old mechanism of retreiving
    the textbox data by using the Request.Form[] indexer, indexing into
    the collection using the textbox ID's stored in viewstate.

    I know that there is the mechanism of re-loading postbackdata in the
    freshly generated page class every postback. I know this happens after
    the pages' control tree is rebuilt during the OnInit event of the page
    itself.

    My question: When I remove the Request.Form[] mechanism from my
    panel_OnInit eventhandler, the filled in text in every textbox goes
    lost on every postback. Can anyon tell me how to automatically re-fill
    the generated textboxes(durin g Panel_OnInit) with the postback data
    from the request ?

    Many Thanks!!

Working...