DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 10 Aug 2007 03:30:57 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Chris Peeters
          2    Brett Wiltshire
                 3    Chris Peeters


ViewState property can not be accessed in derived class ???   
Hi,

Using inheritance, doesn't 'protected' mean that derived classes can
access that data if specified as protected in the base class ?

Aparently not: ViewState property is declared as protected in the
Control class. ListBox inherits (indirectly) from Control but the
ViewState property can not be accessed ???

It generates following compiler error : 
 "Cannot access protected member 
 'System.Web.UI.Control.ViewState' via a qualifier of type 
 'System.Web.UI.WebControls.ListBox'; the qualifier must be of 
 type 'PageCounter' (or derived from it)"

How come ?

Thank you
Chris

*** Sent via Developersdex http://www.developersdex.com ***
Date:Fri, 10 Aug 2007 03:30:57 -0700   Author:  

Re: ViewState property can not be accessed in derived class ???   
On 10 Aug, 11:30, Chris Peeters  wrote:

> Hi,
>
> Using inheritance, doesn't 'protected' mean that derived classes can
> access that data if specified as protected in the base class ?
>
> Aparently not: ViewState property is declared as protected in the
> Control class. ListBox inherits (indirectly) from Control but the
> ViewState property can not be accessed ???
>
> It generates following compiler error :
>  "Cannot access protected member
>  'System.Web.UI.Control.ViewState' via a qualifier of type
>  'System.Web.UI.WebControls.ListBox'; the qualifier must be of
>  type 'PageCounter' (or derived from it)"
>
> How come ?
>
> Thank you
> Chris
>
> *** Sent via Developersdexhttp://www.developersdex.com***


Hi Chris,

Are you writing a derived class?

Perhaps you could post some code to clarify the problem you're having?


Brett.
Date:Fri, 10 Aug 2007 03:39:18 -0700   Author:  

Re: ViewState property can not be accessed in derived class ???   
Hello,

I just try to type in Page_Load()

  lstColors.ViewState["test"] = 0;

with lstColors defined as a normal  asp-ListBox.

ViewState is the inherited property.

but I realised what i am doing wrong:

I try to access the listbox-protected property from a different class,
page-class , which is not allowed of course !
Page class can only access its own inherited ViewState-property.

thanks anyway
Chris

*** Sent via Developersdex http://www.developersdex.com ***
Date:Fri, 10 Aug 2007 05:11:51 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us