Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page level (user defined) properties?

Reply
Thread Tools

Page level (user defined) properties?

 
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      05-31-2007
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,
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      05-31-2007
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,

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c is a low-level language or neither low level nor high level language pabbu C Programming 8 11-07-2005 03:05 PM
page-level vs control-level enableViewState =?Utf-8?B?Sm9l?= ASP .Net 3 10-26-2005 07:14 PM
Is Cisco PIX Application level firewall or Packet level firewall? Learning Cisco Cisco 3 10-15-2005 12:55 AM
Accessing higher security level from higher security level nderose@gmail.com Cisco 0 07-11-2005 10:20 PM
Page Level and Applicatoin Level Custom Errors rranveer@gmail.com ASP .Net 2 02-13-2005 02:03 AM



Advertisments