473,387 Members | 1,515 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,387 software developers and data experts.

Codebehind Variable State ?

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
Nov 17 '05 #1
1 921
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...

"Chris" <an*******@discussions.microsoft.com> wrote in message
news:0e****************************@phx.gbl...
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

Nov 17 '05 #2

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

Similar topics

4
by: Varun | last post by:
I want to access the variable in the codebehind in the javascript How can i do that Varun
2
by: M | last post by:
Hello. I need an example of how to call an assembly function/method from a webform page. I don't want to use a codebehind (nor embedded c# code), like so: <asp:DataGrid runat="server"...
6
by: Nehal Shah | last post by:
I've read that in the Page Directive of an aspx page, changing the CodeBehind attribute to Src saves you from having to compile the page before refreshing. This is preferable in a large...
5
by: Allan M. | last post by:
I have a series of select boxes that must be populated client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a...
3
by: nevets2001uk | last post by:
Hi. I've just started my second ASP.NET (VB) app and I'm using codebehind this time. I'm not using visual studio but am instead coding it all in notepad (HTML, ASP.NET and CSS) I'm trying to...
4
by: Mat | last post by:
Hi, I am having a bit of a problem trying to access / set properties of a usercontrol from the parent codebehind. This is what I have so far.. simple.aspx <%@ Page...
0
by: N. Demos | last post by:
Hello, I have a custom usercontrol, of which I have two instances of in my aspx page. Both the usercontrol and page have codebehind. In the page codebehind, I want a member variable for each...
6
by: RFS666 | last post by:
Hello, After I posted yesterday "using C# class in jscript", I have a new problem: I have a C# class - DBResult - that contains (and other variables) a string array (and other variables), that...
1
by: Antoine | last post by:
I have a pretty quickish question about ASPX with codebehind. I have done an exhaustive search of the web so no go there. I was hoping to reach out for some help here. Anyway, I have a really...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.