Hi all
I have converted a simple project from ASP.NET 1 to 2.0 with the latest
prerelease of Visual Studio 2005. The problem is I can't access internal
members from the code behind. It gives: error CS0122: 'Class' is
inaccessible due to its protection level
This happens only when access members from code behind, not from the other
classes. It compiles OK when making the class and its members public.
However, I don't want to do that.
Any suggestions will be appreciated
Thanks
Plamen 6 2323
Have you made some "protected" fields public to get access to controls
and/or their values?
I know that the conversion wizard changes this to fit in with the partial
class auto-generated code. The way to fix it being to expose the
properties/controls as public properties that wrap the access to those
control properties or the property values themselves, and have your consumer
classes reference/use the public properties, rather than the modified
"public" fields (which were originally private or protected.
--
- Paul Glavich
MVP ASP.NET http://weblogs.asp.net/pglavich
ASPInsiders member - http://www.aspinsiders.com
"Plamen Doykov" <p_******@code.bg> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl... Hi all
I have converted a simple project from ASP.NET 1 to 2.0 with the latest prerelease of Visual Studio 2005. The problem is I can't access internal members from the code behind. It gives: error CS0122: 'Class' is inaccessible due to its protection level This happens only when access members from code behind, not from the other classes. It compiles OK when making the class and its members public. However, I don't want to do that. Any suggestions will be appreciated
Thanks Plamen
I have not played with this for awhile, so I can only give you a response
that will put you on the right track. It will be up to you to determine the
path.
Reason: By default, ASP.NET 2.0 compiles each page to a separate class
assembly. You can, however, precompile the application and, if my
recollection is correct, this compiles into a single assembly. In a single
assembly, internal methods are accessible; in separate assemblies, they are
not.
There is a downside to going to single assembly builds, however. You cannot
update single pages without a full site deploy. This is like the 1.x model,
so it not a big deal.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Plamen Doykov" wrote: Hi all
I have converted a simple project from ASP.NET 1 to 2.0 with the latest prerelease of Visual Studio 2005. The problem is I can't access internal members from the code behind. It gives: error CS0122: 'Class' is inaccessible due to its protection level This happens only when access members from code behind, not from the other classes. It compiles OK when making the class and its members public. However, I don't want to do that. Any suggestions will be appreciated
Thanks Plamen
re: Reason: By default, ASP.NET 2.0 compiles each page to a separate class assembly. You can, however, precompile the application and, if my recollection is correct, this compiles into a single assembly.
We may soon have an option to compile to a single assemby without
needing to pre-compile the application, according to Scott Guthrie : http://weblogs.asp.net/scottgu/archi...28/423888.aspx
"Note: one request we've heard from several people since Beta2 has been to
provide a new third compilation granularity option above which would allow you
to merge the assembly output from multiple directories into a single assembly
that has a well known name that you define (and which does not change across
re-builds - which is one unfortunate side-affect of the per-directory build option today).
We are working on a tool right now that does this, and have a prototype up and
running that seems to work great. I'll provide more details on this over the next
week or two once we confirm that it fully works for all scenarios."
He announced that last August 28, although the tool hasn't been made available yet.
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM> wrote in message
news:BF**********************************@microsof t.com...I have not played with this for awhile, so I can only give you a response that will put you on the right track. It will be up to you to determine the path.
Reason: By default, ASP.NET 2.0 compiles each page to a separate class assembly. You can, however, precompile the application and, if my recollection is correct, this compiles into a single assembly. In a single assembly, internal methods are accessible; in separate assemblies, they are not.
There is a downside to going to single assembly builds, however. You cannot update single pages without a full site deploy. This is like the 1.x model, so it not a big deal.
-- Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA
*************************** Think Outside the Box! ***************************
"Plamen Doykov" wrote:
Hi all
I have converted a simple project from ASP.NET 1 to 2.0 with the latest prerelease of Visual Studio 2005. The problem is I can't access internal members from the code behind. It gives: error CS0122: 'Class' is inaccessible due to its protection level This happens only when access members from code behind, not from the other classes. It compiles OK when making the class and its members public. However, I don't want to do that. Any suggestions will be appreciated
Thanks Plamen
Thanks
It still doesn't work for me, but at least I know what is going on after
reading Scott Guthrie' blog.
It seems quite strange to me to have by default building assemblies for each
subdirectory in the project. Subdirectories are designed from an user
interface point of view while building units (assemblies in this case)
follow a different design logic. Having an option for each page to be in its
own assembly can be reasonable, but I would certainly expect each project to
build in its own assembly, thus leaving (and even forcing) the designer to
carefully chose wich code goes into which assembly. Unfortunately this
obviously sensible option is still left unimplemented in VS2005. Strange
logic.
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl... re: Reason: By default, ASP.NET 2.0 compiles each page to a separate class assembly. You can, however, precompile the application and, if my recollection is correct, this compiles into a single assembly. We may soon have an option to compile to a single assemby without needing to pre-compile the application, according to Scott Guthrie :
http://weblogs.asp.net/scottgu/archi...28/423888.aspx
"Note: one request we've heard from several people since Beta2 has been to provide a new third compilation granularity option above which would allow
you to merge the assembly output from multiple directories into a single
assembly that has a well known name that you define (and which does not change
across re-builds - which is one unfortunate side-affect of the per-directory
build option today). We are working on a tool right now that does this, and have a prototype up
and running that seems to work great. I'll provide more details on this over
the next week or two once we confirm that it fully works for all scenarios."
He announced that last August 28, although the tool hasn't been made
available yet.
Juan T. Llibre, ASP.NET MVP ASP.NET FAQ : http://asp.net.do/faq/ Foros de ASP.NET en Español : http://asp.net.do/foros/ ======================================
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM>
wrote in message news:BF**********************************@microsof t.com...I have not played with this for awhile, so I can only give you a response that will put you on the right track. It will be up to you to determine
the path.
Reason: By default, ASP.NET 2.0 compiles each page to a separate class assembly. You can, however, precompile the application and, if my recollection is correct, this compiles into a single assembly. In a
single assembly, internal methods are accessible; in separate assemblies, they
are not.
There is a downside to going to single assembly builds, however. You
cannot update single pages without a full site deploy. This is like the 1.x
model, so it not a big deal.
-- Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA
*************************** Think Outside the Box! ***************************
"Plamen Doykov" wrote:
Hi all
I have converted a simple project from ASP.NET 1 to 2.0 with the latest prerelease of Visual Studio 2005. The problem is I can't access
internal members from the code behind. It gives: error CS0122: 'Class' is inaccessible due to its protection level This happens only when access members from code behind, not from the
other classes. It compiles OK when making the class and its members public. However, I don't want to do that. Any suggestions will be appreciated
Thanks Plamen
asp.net 1.1 built all pages into individual assemblies (unless batch is
used). while VS2003 compiled all the codebehind into one dll each aspx page
became it own assembly.
VS2005 uses partial classes to get around all the problems of the 1.1
codebehind model, a side effect is the seperate dll. if you want pages
talking to each other, you should use the base class model, as the VS2005
import wizard does.
-- bruce (sqlwork.com)
"Plamen Doykov" <p_******@code.bg> wrote in message
news:O3**************@TK2MSFTNGP14.phx.gbl... Thanks
It still doesn't work for me, but at least I know what is going on after reading Scott Guthrie' blog. It seems quite strange to me to have by default building assemblies for each subdirectory in the project. Subdirectories are designed from an user interface point of view while building units (assemblies in this case) follow a different design logic. Having an option for each page to be in its own assembly can be reasonable, but I would certainly expect each project to build in its own assembly, thus leaving (and even forcing) the designer to carefully chose wich code goes into which assembly. Unfortunately this obviously sensible option is still left unimplemented in VS2005. Strange logic. "Juan T. Llibre" <no***********@nowhere.com> wrote in message news:u0**************@TK2MSFTNGP14.phx.gbl... re: > Reason: By default, ASP.NET 2.0 compiles each page to a separate > class assembly. You can, however, precompile the application and, > if my recollection is correct, this compiles into a single assembly.
We may soon have an option to compile to a single assemby without needing to pre-compile the application, according to Scott Guthrie :
http://weblogs.asp.net/scottgu/archi...28/423888.aspx
"Note: one request we've heard from several people since Beta2 has been to provide a new third compilation granularity option above which would allow you to merge the assembly output from multiple directories into a single assembly that has a well known name that you define (and which does not change across re-builds - which is one unfortunate side-affect of the per-directory build option today). We are working on a tool right now that does this, and have a prototype up
and running that seems to work great. I'll provide more details on this over the next week or two once we confirm that it fully works for all scenarios."
He announced that last August 28, although the tool hasn't been made available yet.
Juan T. Llibre, ASP.NET MVP ASP.NET FAQ : http://asp.net.do/faq/ Foros de ASP.NET en Español : http://asp.net.do/foros/ ======================================
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM>
wrote in message news:BF**********************************@microsof t.com... >I have not played with this for awhile, so I can only give you a >response > that will put you on the right track. It will be up to you to determine the > path. > > Reason: By default, ASP.NET 2.0 compiles each page to a separate class > assembly. You can, however, precompile the application and, if my > recollection is correct, this compiles into a single assembly. In a single > assembly, internal methods are accessible; in separate assemblies, they are > not. > > There is a downside to going to single assembly builds, however. You cannot > update single pages without a full site deploy. This is like the 1.x model, > so it not a big deal. > > -- > Gregory A. Beamer > MVP; MCP: +I, SE, SD, DBA > > *************************** > Think Outside the Box! > *************************** > > > "Plamen Doykov" wrote: > >> Hi all >> >> I have converted a simple project from ASP.NET 1 to 2.0 with the >> latest >> prerelease of Visual Studio 2005. The problem is I can't access internal >> members from the code behind. It gives: error CS0122: 'Class' is >> inaccessible due to its protection level >> This happens only when access members from code behind, not from the other >> classes. It compiles OK when making the class and its members public. >> However, I don't want to do that. >> Any suggestions will be appreciated >> >> Thanks >> Plamen >> >> >>
On Tue, 11 Oct 2005 09:35:50 -0400, "Juan T. Llibre"
<no***********@nowhere.com> wrote: He announced that last August 28, although the tool hasn't been made available yet.
I've heard it will be availble around RTM time, or soon thereafter -
but it is coming, and it's not spang :)
--
Scott http://www.OdeToCode.com/blogs/scott/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Roger Leigh |
last post by:
The C++ book I have to hand (Liberty and Horvath, Teach yourself C++
for Linux in 21 Days--I know there are better) states that "static
member functions cannot access any non-static member...
|
by: Bob |
last post by:
In C++, default access is private. In Java, default access is package. In
C++, default access is ___________ ??
|
by: C-Sharper or C-Hasher, one of the two |
last post by:
Hi,
I have a C# class libary (Class1) which is inherited by another class in a
Windows Forms app. I want this other class to implement some, but not all of
the features of the base class. How...
|
by: Liz |
last post by:
ok, this is really simple stuff, or it should be ... but I'm stuck
In a Windows Forms app, I have something resembling this:
Form1.cs
========
namespace NS
Class Form1
|
by: =?Utf-8?B?R2Vvcmdl?= |
last post by:
Hello everyone,
I met with a strange issue that derived class function can not access base
class's protected member. Do you know why?
Here is the error message and code.
error C2248:...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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...
|
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...
| |