|
-
April 30th, 2003, 11:11 AM
#1
Variable problem
I have a class and in the class I declared a variable public. In the page load event I set the variable to a value. When a user presses a button I reference the variable. For some reason that variable always loses its value. Why??????
Public Class Motion
public NextOne as integer
Private Sub Page_Load
NextOne = 4
End Sub
Private Sub OnButton
dim i as integer
i = NextOne
End Sub
End class
This is a very rough layout that I am doing. I trace through pageload and nextone is equal 4 but as soon as onbutton is called it changes to zero.
-
April 30th, 2003, 03:07 PM
#2
I assume your talking about a web page. If so you need to realize that the variables you're defining only "live" while the server is processing the page. Once it is sent to the client, it no longer exsists on the server. To do what you're trying to do, you'll need to put the value on a hidden control on the webpage and set it's EnableViewState property to true.
-
May 1st, 2003, 08:36 AM
#3
Thanks
This is my first project assigned for the web. This was frustrating me to no end.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|