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

is this possible? string field member already set on page init

this is what i experienced in my web application and i realy do not
understand.

this is my web page class behind
public class MyWebPage : System.Web.UI.Page
{
//some page controls
.....

//this is problematic field, it is meant to be internal server cache
variable for DocumentClass property
private string m_searchDocumentClass = null;
//property
protected string DocumentClass
{
get
{
if( m_searchDocumentClass == null )
{
if( searchObject != null )
{
m_searchDocumentClass =
searchObject.GetDocumentClass( );
}
else
{
m_searchDocumentClass = "Default";
}
}
return m_searchDocumentClass;
}
}

protected SearchObject searchObject
{
get
{
return ( SearchObject )Session[ "SearchObject" ];
}
}

//some methods
.....

//init
protected override void OnInit( System.EventArgs e )
{
if( !Page.IsPostBack )
{
//some first time init stuff
InitSearchObject();
}

//some controls init stuff
}
}

for the first time everything is ok. InitSearchObject is called.
m_searchDocumentClass is null. then it is set to "Default".
purpose of m_searchDocumentClass is to cache it for server page life only.
so one does not have to search for this stuff
everytime it is needed.
then controls are created and page is sent to client.
second time when post back occurs ( for example someone has clicked some
button on the page ), in page init m_searchDocumentClass
is already set, and i am realy, realy confused about it, because i expect it
to be null.
can this happen? and if yes, why, when and what properties or whatever is
needed to accomplish this situation?

ps. the only reference to m_searchDocumentClass is realy in DocumentClass
property getter.
i looked throug my code several times, searched for occurences of
m_searchDocumentClass, and only place it is set is in DocumentClass
property getter.

thank you for any comment, help, opinion or anything.
Nov 18 '05 #1
1 1469
well, the problem was solved by restarting aspnet_wp.exe process.
hmm......

"mato" <mb*******@gratex.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
this is what i experienced in my web application and i realy do not
understand.

this is my web page class behind
public class MyWebPage : System.Web.UI.Page
{
//some page controls
.....

//this is problematic field, it is meant to be internal server cache
variable for DocumentClass property
private string m_searchDocumentClass = null;
//property
protected string DocumentClass
{
get
{
if( m_searchDocumentClass == null )
{
if( searchObject != null )
{
m_searchDocumentClass =
searchObject.GetDocumentClass( );
}
else
{
m_searchDocumentClass = "Default";
}
}
return m_searchDocumentClass;
}
}

protected SearchObject searchObject
{
get
{
return ( SearchObject )Session[ "SearchObject" ];
}
}

//some methods
.....

//init
protected override void OnInit( System.EventArgs e )
{
if( !Page.IsPostBack )
{
//some first time init stuff
InitSearchObject();
}

//some controls init stuff
}
}

for the first time everything is ok. InitSearchObject is called.
m_searchDocumentClass is null. then it is set to "Default".
purpose of m_searchDocumentClass is to cache it for server page life only.
so one does not have to search for this stuff
everytime it is needed.
then controls are created and page is sent to client.
second time when post back occurs ( for example someone has clicked some
button on the page ), in page init m_searchDocumentClass
is already set, and i am realy, realy confused about it, because i expect it to be null.
can this happen? and if yes, why, when and what properties or whatever is
needed to accomplish this situation?

ps. the only reference to m_searchDocumentClass is realy in DocumentClass
property getter.
i looked throug my code several times, searched for occurences of
m_searchDocumentClass, and only place it is set is in DocumentClass
property getter.

thank you for any comment, help, opinion or anything.

Nov 18 '05 #2

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

Similar topics

6
by: prettysmurfed | last post by:
Hi all I have a bit of a problem, the subject of this post is almost selfexplaing. But here goes: Heres an example of the code I want to implement, its all nice and simple, but the flaw is I...
10
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
13
by: Alison Givens | last post by:
....... that nobody knows the answer. I can't imagine that I am the only one that uses parameters in CR. So, my question again: I have the following problem. (VB.NET 2003 with CR) I have a...
6
by: laikon | last post by:
Hi, everyone, below is my program to test static pointer data member; class A { private: static A* p; protected: A() {} public: static A* init()
11
by: utab | last post by:
Dear all, in a class definition class X{ private: static map< string , map<string, int word_map; static void initialize(); };
4
by: Josefo | last post by:
Hello, is someone so kind to tell me why I am getting the following errors ? vector_static_function.c:20: error: expected constructor, destructor, or type conversion before '.' token...
1
by: newbie | last post by:
This is a snippet from C++ FAQs, which I have never done--- when I do such a thing, I would declare function used by constructor ( in this example, init() ) as static. But I do understand that it...
3
by: Goran | last post by:
Hi @ all! Is it possible to overload a member variable? Example: class ClassA_t {
6
by: tgnelson85 | last post by:
Hello, C question here (running on Linux, though there should be no platform specific code). After reading through a few examples, and following one in a book, for linked lists i thought i would...
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: 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
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.