Preserving POSTBACK data on dynamically added textboxes

R

rvdnieuwenhuizen

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(during Panel_OnInit) with the postback data
from the request ?

Many Thanks!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top