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

Nodes.Clear() is also erasing my session variables

Hi. I have a TreeView stored in a session variable...is ok...problem is when
I use Nodes.Clear() then my session variable that holds the TreeView is also
emptied! Is this behavior by design or it's some kind of bug??

Thanks,

Alex.
Nov 23 '05 #1
4 1119
See post from above. There is no logical reason
to store the control itself in session.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"Alex D." <al********@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP12.phx.gbl...
Hi. I have a TreeView stored in a session variable...is ok...problem is
when I use Nodes.Clear() then my session variable that holds the TreeView
is also emptied! Is this behavior by design or it's some kind of bug??

Thanks,

Alex.

Nov 23 '05 #2
so..your answer is? yes or no?

"Robbe Morris [C# MVP]" <in**@eggheadcafe.com> wrote in message
news:OZ**************@TK2MSFTNGP15.phx.gbl...
See post from above. There is no logical reason
to store the control itself in session.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"Alex D." <al********@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP12.phx.gbl...
Hi. I have a TreeView stored in a session variable...is ok...problem is
when I use Nodes.Clear() then my session variable that holds the TreeView
is also emptied! Is this behavior by design or it's some kind of bug??

Thanks,

Alex.


Nov 23 '05 #3
yes, by design.

if you use inproc sessions (the default), you a storing a reference to
control in session. if you make changes to the control, the changes are
reflected in session because its the same object. this is different than
value types.
string a = "hello";
string b = a; // b = "hello";
a = "bye"; // b still = "hello" because a now points to a new string

now lets look at objects

class test {
public string value = "hello";
}

test a = new test();
test b = a;
a.value = "bye"; // b.value = "bye", because a is not pointing to
a new object,
// a method was just called on the
common object
a = new test(); // make a point to new object
a.value = "more"; // b.value is still "bye", because a now points to
a new object
-- bruce (sqlwork.com)

"Alex D." <al********@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP12.phx.gbl...
Hi. I have a TreeView stored in a session variable...is ok...problem is
when I use Nodes.Clear() then my session variable that holds the TreeView
is also emptied! Is this behavior by design or it's some kind of bug??

Thanks,

Alex.

Nov 23 '05 #4
yes...I dont know why I thougt that session variables were only values and
no references....thanks!

"Bruce Barker" <br******************@safeco.com> wrote in message
news:ey**************@TK2MSFTNGP15.phx.gbl...
yes, by design.

if you use inproc sessions (the default), you a storing a reference to
control in session. if you make changes to the control, the changes are
reflected in session because its the same object. this is different than
value types.
string a = "hello";
string b = a; // b = "hello";
a = "bye"; // b still = "hello" because a now points to a new
string

now lets look at objects

class test {
public string value = "hello";
}

test a = new test();
test b = a;
a.value = "bye"; // b.value = "bye", because a is not pointing
to a new object,
// a method was just called on the
common object
a = new test(); // make a point to new object
a.value = "more"; // b.value is still "bye", because a now points
to a new object
-- bruce (sqlwork.com)

"Alex D." <al********@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP12.phx.gbl...
Hi. I have a TreeView stored in a session variable...is ok...problem is
when I use Nodes.Clear() then my session variable that holds the TreeView
is also emptied! Is this behavior by design or it's some kind of bug??

Thanks,

Alex.


Nov 23 '05 #5

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

Similar topics

10
by: Peter | last post by:
I want to draw some lines on a widget. This works ok, but when I want to redraw, the old lines are still there. How do I clear or refresh the widget, so I can draw a new set of lines? Code...
9
by: Rolf Kemper | last post by:
Dear Experts, I got stuck with the following problem and need your help. What I wnat to do is to get a set of distinct nodes. Before the distinct I have selected the multiple occourences...
2
by: Tomomichi Amano | last post by:
Hello How can I delete (clear) lines that were made useing Graphics.DrawLine() ? Thanks in advance! Have a nice day!
3
by: JezB | last post by:
I want to clear some specific Session variables when the user closes a page. On my page I have a "return to ..." button which navigates back to the parent page from which it was invoked - under the...
5
by: tshad | last post by:
When I log of I do: HttpContext.Current.Session.Clear() FormsAuthentication.SignOut() The problem is that it clears the variables that I set up in my Session_Start function in my...
1
by: prefersgolfing | last post by:
I have set up several session variables and can read/write as expected. My problem is when I start another debug session the variables are retaining the values from the previous debug session. I've...
3
by: juvi | last post by:
Hi, I have got a problem with Treeview.Nodes.Clear() under VB2005. When I have some nodes in my treeview and a force to clear() all nodes then it seems to work, because the nodes are not visible....
2
by: Kristopher Wragg | last post by:
I'm having some serious problems with the TreeView control. I've got a control that inherits TreeView and has some methods that firstly create a TreeNode then does some recursive procedure to add...
9
by: stack | last post by:
Hi all, I am creating a web app using JSP. I have a bean with some variables whose values are set by the user by using a form in a jsp (method is post). When the user enters those values these are...
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
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
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.