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

StateItem Class

I took this function on using viewstate from Microsoft MSDN at
http://msdn.microsoft.com/library/de...classtopic.asp

and am getting this error: System.Web.UI.Control.viewState is not
accessible in this context because it is "Private".

There is always something in these articles they don't tell you, what am I
missing??? It's stopping at the Dim myDictionaryEnumerator As
IDictionaryEnumerator = _viewstate.GetEnumerator()

Public Function EnumerateViewState() As String
Dim keyName, keyValue As String
Dim result As String = [String].Empty
Dim myStateItem As StateItem
Dim myDictionaryEnumerator As IDictionaryEnumerator =
_viewstate.GetEnumerator()
While myDictionaryEnumerator.MoveNext()
keyName = CStr(myDictionaryEnumerator.Key)
myStateItem = CType(myDictionaryEnumerator.Value, StateItem)
keyValue = CStr(myStateItem.Value)
result = result + "<br>ViewState[" + keyName + "] = " + keyValue
End While
Return result
End Function 'EnumerateViewState
Nov 19 '05 #1
3 950
"Rock" <ro********@yahoo.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
I took this function on using viewstate from Microsoft MSDN at
http://msdn.microsoft.com/library/de...classtopic.asp

and am getting this error: System.Web.UI.Control.viewState is not
accessible in this context because it is "Private".

There is always something in these articles they don't tell you, what am I
missing??? It's stopping at the Dim myDictionaryEnumerator As
IDictionaryEnumerator = _viewstate.GetEnumerator()

Public Function EnumerateViewState() As String
Dim keyName, keyValue As String
Dim result As String = [String].Empty
Dim myStateItem As StateItem
Dim myDictionaryEnumerator As IDictionaryEnumerator =
_viewstate.GetEnumerator()
While myDictionaryEnumerator.MoveNext()
keyName = CStr(myDictionaryEnumerator.Key)
myStateItem = CType(myDictionaryEnumerator.Value, StateItem)
keyValue = CStr(myStateItem.Value)
result = result + "<br>ViewState[" + keyName + "] = " + keyValue
End While
Return result
End Function 'EnumerateViewState


I don't see this code at that URL.

Also, I suspect you should be using "ViewState" and not "_viewstate".

John Saunders
Nov 19 '05 #2
Well, I copied the url but it's going to the StateBag class.

Search for the StateItem class, in my case it's the first article that comes
up, it doesn't have an article number or anything else that I can reference
to. Thanks for your help.

"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Rock" <ro********@yahoo.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
I took this function on using viewstate from Microsoft MSDN at
http://msdn.microsoft.com/library/de...classtopic.asp
and am getting this error: System.Web.UI.Control.viewState is not
accessible in this context because it is "Private".

There is always something in these articles they don't tell you, what am I missing??? It's stopping at the Dim myDictionaryEnumerator As
IDictionaryEnumerator = _viewstate.GetEnumerator()

Public Function EnumerateViewState() As String
Dim keyName, keyValue As String
Dim result As String = [String].Empty
Dim myStateItem As StateItem
Dim myDictionaryEnumerator As IDictionaryEnumerator =
_viewstate.GetEnumerator()
While myDictionaryEnumerator.MoveNext()
keyName = CStr(myDictionaryEnumerator.Key)
myStateItem = CType(myDictionaryEnumerator.Value, StateItem)
keyValue = CStr(myStateItem.Value)
result = result + "<br>ViewState[" + keyName + "] = " + keyValue
End While
Return result
End Function 'EnumerateViewState


I don't see this code at that URL.

Also, I suspect you should be using "ViewState" and not "_viewstate".

John Saunders

Nov 19 '05 #3
"Rock" <ro********@yahoo.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
Well, I copied the url but it's going to the StateBag class.

Search for the StateItem class, in my case it's the first article that
comes
up, it doesn't have an article number or anything else that I can
reference
to. Thanks for your help.


This is a bad example. Please inform Microsoft. It doesn't show the
definition of _viewState, so you are picking up a definition of _viewState
from a base class (Control). That definition is private, so you can't use it
(and maybe it's the wrong thing anyway).

John Saunders
Nov 19 '05 #4

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

Similar topics

1
by: Murat Tasan | last post by:
hi, i am having a small problem with constructing an inner class. i am using an inner class (and not a static nested class) because the methods of the inner class need access to the enclosing...
2
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A,...
2
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a...
3
by: Robert | last post by:
Python doesn't know the class of a method when container not direct class attribute: >>> class X: .... def f():pass .... g=f .... l= .... >>> X.g <unbound method X.f>
1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...

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.