Simple question on Viewstate

D

Danny

Hi,

I have a very simple asp.net application with a webform and an integer data
member. I've placed a button on this form which increments the integer data
member by 1 each time it is clicked and displays it with Response.Write.
The data member's value is not saved in each button click, and the value
always stays the same.
I have viewstate enabled for the page.
How can I change this behavour ?

Thanks,

Danny
 
R

rovshan

Hi,

if that member is simply a class member you will not have
it's value saved between posts. Consider keeping it in
ViewState

Thanks,
Rovshan
 
D

Danny

Ok, then how do you suggest this should be done?
What if it's an object such as an enumerator I want to keep? And one last
question - in case of a mobile form, I don't have ViewState. Are there any
alternatives?
 

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,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top