Arrays doesn't save between calls

  • Thread starter Thread starter Giorgio Gentili
  • Start date Start date
G

Giorgio Gentili

Hello all, I'm making a page to answer about 180 questions, so, i made
possible that the user choose how many columns and rows are displayed in
each page depending on his resolution and others factors, so i display this
page until all the questions are answered, but my trouble starts when i took
the answered page and store the options (all questions are radio button
lists) in an array, because, the data isn't saved with each view. I know i
can use viewstate to do this but i don't understand when it's necesary and
when isn't, why, because i first put the data in Form_Load and doesn't store
anything, but if i make the initialization in the init_page some data are
stored between calls, please anyone could explain to me this issue.

Thanks,

Giorgio

PS: Sorry about the English :-D
 
Hi,

Pages are stateless so you can’t preserve data between them. You must
preserve data between calls and you got two options to do so.

1) You can use viewstate / hidden field to save the previous answers and
send them back and forth between client and server.
2) Use session collection to store the answers on the server between
pages calls.

Natty Gur[MVP]

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