ASP 2: item from arraylist vanished ?!

G

G. Völkl

Hello,

I have a real simple asp.net 2.0 page::

1 button - 1 textfield

If you press the button, the value of the textfield will be added to the
arraylist:

private x as new arraylist

protected sub button_click( ....)
x.add(txtFeld.text)
end sub

If you press the button again the item of the arraylist is vanished. Whats
worng?

Thanks

Best regards
Gerhard
 
K

Karl Seguin

You aren't persisting your arraylist from page visits to page visits. every
time you are recreating a new arraylist and starting from scratch. Store it
somewhere, like the viewstate or the session, and retrieve it from said
storage when Page.IsPostback

Karl
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top