Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Simple question on Viewstate

Reply
Thread Tools

Simple question on Viewstate

 
 
Danny
Guest
Posts: n/a
 
      11-15-2003
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


 
Reply With Quote
 
 
 
 
rovshan
Guest
Posts: n/a
 
      11-15-2003
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

>-----Original Message-----
>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
>
>
>.
>

 
Reply With Quote
 
 
 
 
Danny
Guest
Posts: n/a
 
      11-15-2003
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?

"rovshan" <(E-Mail Removed)> wrote in message
news:08f901c3ab83$4f551f70$(E-Mail Removed)...
> 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
>
> >-----Original Message-----
> >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
> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with ViewState: "function 'ViewState.get_Item' evaluated and returned null" Steph ASP .Net 2 05-11-2011 02:35 PM
Errors: Failed to load viewstate. & Validation of viewstate MAC failed. sck10 ASP .Net 6 09-01-2006 05:59 PM
Loading usercontrols, viewstate problem, slighly different from all others "viewstate uc problems" please help... ujjc001 ASP .Net 0 07-27-2005 01:52 PM
Viewstate errors... how do I get viewstate working? mark ASP .Net Building Controls 0 02-20-2004 02:17 PM
Corrupted ViewState (Yes, another issue concerning viewstate) Ben Rush ASP .Net 2 12-05-2003 04:17 PM



Advertisments