all groups > asp.net building controls > may 2006 >
You're in the

asp.net building controls

group:

view state question



view state question mr. App
5/16/2006 12:00:00 AM
asp.net building controls: In many custom controls examples I see the following code:
public string Text
{
get
{
return (string)ViewState["Text"];
}

set
{
ViewState["Text"] = value;
}
}

Can you please explain what is the difference between this code to:
public string Text
{
get
{
return Text;
}

set
{
Text = value;
}
}

Thanks.

Re: view state question Nathan Sokalski
5/17/2006 11:37:04 PM
The difference is that the first one is getting the value from ViewState,
while the second one is getting it from a variable named Text.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

[quoted text, click to view]

Re: view state question Brock Allen
5/18/2006 7:09:18 PM
[quoted text, click to view]


And buggy, since it's recursive.

-Brock
http://staff.develop.com/ballen


[quoted text, click to view]

AddThis Social Bookmark Button