473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

page_load and session variable

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.
Nov 18 '05 #1
2 1634
tony collier <me*****@hotmail.com> wrote in
news:Xn*******************************@140.99.99.1 30:
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?
Nov 18 '05 #2
Tony,

How about if you define a property for your page whose accessor (get)
returns the array stored in the session (as an array)?
--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lsf_80 | last post by:
I am using ASP.net and C# as code behind. I wrote one function in the "page load" (code behind) and how can i call back the variable in the aspx page? Thank you. if i put response.write,...
2
by: Jason | last post by:
I have an ASP.NET page that needs to use values set in session variables to perform certain functions. I have code in the Page_Load event that makes sure the session has not been restarted: If...
2
by: Frank Schumacher | last post by:
Hi Folks, I have a problem with the order of events fired by ASP.NET. I found many articles which explaining the lifecycle of a site, but I found none which took the event from a Control on the...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
2
by: JIM.H. | last post by:
Hello, I have two apsx pages, and I set a session variable in asp1 and click to a button to go to aspx2. In aspx2, I use this session variable in the query and show data on the datagrid. I do this...
4
by: tshad | last post by:
Is there a way to do put Page_loads on a page? I am trying to setup a Page_Load that just puts a persons name that is logged on at the top of a page the first time a page is loaded. In my...
0
by: jonelling | last post by:
I am having a problem where the page load event is not being fired for certain user controls that I load dynamically in placeholders. Here is what I'm doing in brief, with full test code supplied...
1
by: puja | last post by:
hi all, I have this .aspx page for which the Page_load event occurs twice. I found out while debugging. After searching google, I tried checking with Page.Ispostback method and also had...
5
by: ShadowLocke | last post by:
Ok..so the title doesnt make much sense. Here is the problem: I have one page, that when loaded checks a session variable to determine that the user is allowed to view the page before sending the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.