By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Page level (user defined) properties?

P: n/a
Hi,

Why doesn’t this property work at the Page level after postback;

public virtual string SomePageProperty
{
get
{
string s = (string) ViewState["SomePageProperty"];
return ((s == null) ? String.Empty : s);
}

set
{
ViewState["SomePageProperty"] = value;
}
}
I've used this type of property declaration in custom WebControls before but
cannot see why it would not work at the Page level, seeing as Page inherits
from Control??
Thanks,
May 31 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
OK,

Please ignore this silly question as I was debugging in the OnInit event and
hence ViewState had not been restored!! I must get more sleep!! ;-)
"Mark" wrote:
Hi,

Why doesn’t this property work at the Page level after postback;

public virtual string SomePageProperty
{
get
{
string s = (string) ViewState["SomePageProperty"];
return ((s == null) ? String.Empty : s);
}

set
{
ViewState["SomePageProperty"] = value;
}
}
I've used this type of property declaration in custom WebControls before but
cannot see why it would not work at the Page level, seeing as Page inherits
from Control??
Thanks,
May 31 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.