Codebehind Variable State ?

C

Chris

I'm writing an asp page with C# codebehind. I create a
page level variable. I then alter the variable by
assigning a new value in a private method. When I access
the vairable again from another private method, the
variable has the original value..

Am I missing a scope issue here? Any ideas welcome...

Thanks,
cj
 
M

Marina

Are you doing this on the same request to the server? Or on different
requests (i.e. after a click event).

If it is the latter, then the reason this is so is because HTTP is a
stateless protcol. The page object is recreated every time - it is not as if
the user is getting the same one on every request. If you need values to
persist between requests, you will need to use session or anothe persistence
mechanism.

If this is not the problem, please post your code...
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top