page_load and session variable

  • Thread starter Thread starter tony collier
  • Start date Start date
T

tony collier

do session variables have to be manipulated in page_load routine? I get a
compiler error when i try to set them inside of <script> </script> if they
aren't in page_load. If so how can i access them from inline code? i have
tried putting public before the variables that grab session data but this
doesn't help

thanks.
 
do session variables have to be manipulated in page_load routine? I
get a compiler error when i try to set them inside of <script>
</script> if they aren't in page_load. If so how can i access them
from inline code? i have tried putting public before the variables
that grab session data but this doesn't help

thanks.

Correction to my original question : First off, ignore the bit about
putting public first - got confused with classes. Anyway, I can access
simple session variables from inline code using

<% =Session["var1"].ToString() %>


however what i really need to access is an array stored in the session
object. As far as i have read so far, this requires making a copy of them
in a page_load located array, manipulating this array and then copying this
back to the session object when done. This is the problem. Because all
this goes on in page_load my inline code can't access the elements of this
copied down array. Any ideas how to get around this please anyone?
 
Tony,

How about if you define a property for your page whose accessor (get)
returns the array stored in the session (as an array)?
 
Back
Top