473,511 Members | 14,052 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is not accessible in this context because it is 'Protected'

I've read through the google posts on this topic and am still unclear of the
solution.

Simply I have a user control that contains form controls and I would like to
reference the values in the form from the aspx page that contains the user
control. The error message received is:
Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is not
accessible in this context because it is 'Protected'.

Thanks

Murphy
Nov 18 '05 #1
6 8640
You have to wrap access to your form fields using properties or methods, or
make your form fields public.

"Murphy" <mu****@murphy.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
I've read through the google posts on this topic and am still unclear of the solution.

Simply I have a user control that contains form controls and I would like to reference the values in the form from the aspx page that contains the user
control. The error message received is:
Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is not
accessible in this context because it is 'Protected'.

Thanks

Murphy

Nov 18 '05 #2
Protected means that only the class in which the member is defined
or derived classes, have access to this member.
You must inherit the class or change the member access modifier to Public.
Sharon.

"Murphy" <mu****@murphy.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
I've read through the google posts on this topic and am still unclear of the solution.

Simply I have a user control that contains form controls and I would like to reference the values in the form from the aspx page that contains the user
control. The error message received is:
Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is not
accessible in this context because it is 'Protected'.

Thanks

Murphy

Nov 18 '05 #3
Thanks Peter,

This is inline with what I discovered in google however I am new to asp.net
and don't understand what this involves.
Does this mean including a including a html "Public" tag in the ascx or
similar ?

Thanks

Murphy

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl...
You have to wrap access to your form fields using properties or methods, or make your form fields public.

"Murphy" <mu****@murphy.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
I've read through the google posts on this topic and am still unclear of the
solution.

Simply I have a user control that contains form controls and I would like to
reference the values in the form from the aspx page that contains the

user control. The error message received is:
Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is not
accessible in this context because it is 'Protected'.

Thanks

Murphy


Nov 18 '05 #4
Thanks Sharon, could you please explain further how this can be achieved.

Murphy

"Sharon" <ta*******@hotmail.com> wrote in message
news:us****************@tk2msftngp13.phx.gbl...
Protected means that only the class in which the member is defined
or derived classes, have access to this member.
You must inherit the class or change the member access modifier to Public.
Sharon.

"Murphy" <mu****@murphy.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
I've read through the google posts on this topic and am still unclear of the
solution.

Simply I have a user control that contains form controls and I would like to
reference the values in the form from the aspx page that contains the

user control. The error message received is:
Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is not
accessible in this context because it is 'Protected'.

Thanks

Murphy


Nov 18 '05 #5
You set the visibility in code, where you define the object. Look in your
code-behind.

"Murphy" <mu****@murphy.com> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
Thanks Peter,

This is inline with what I discovered in google however I am new to asp.net and don't understand what this involves.
Does this mean including a including a html "Public" tag in the ascx or
similar ?

Thanks

Murphy

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl...
You have to wrap access to your form fields using properties or methods,

or
make your form fields public.

"Murphy" <mu****@murphy.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
I've read through the google posts on this topic and am still unclear of
the
solution.

Simply I have a user control that contains form controls and I would like
to
reference the values in the form from the aspx page that contains the

user control. The error message received is:
Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is

not accessible in this context because it is 'Protected'.

Thanks

Murphy



Nov 18 '05 #6
Peter, The object is defined with the following code:

<asp:TextBox id="Company" runat="server" MaxLength="50"
size="50"></asp:TextBox>

As opposed to being defined in vb code such as:

Private Sub CreateMyMultilineTextBox()
' Create an instance of a TextBox control.
Dim textBox1 As New TextBox()

' Set the Multiline property to true.
textBox1.Multiline = True
' Add vertical scroll bars to the TextBox control.
textBox1.ScrollBars = ScrollBars.Vertical
' Allow the RETURN key to be entered in the TextBox control.
textBox1.AcceptsReturn = True
' Allow the TAB key to be entered in the TextBox control.
textBox1.AcceptsTab = True
' Set WordWrap to True to allow text to wrap to the next line.
textBox1.WordWrap = True
' Set the default text of the control.
textBox1.Text = "Welcome!"
End Sub

With the object being set as a web form control how can I make it public ?

Thanks

Murphy

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uZ**************@TK2MSFTNGP12.phx.gbl...
You set the visibility in code, where you define the object. Look in your
code-behind.

"Murphy" <mu****@murphy.com> wrote in message
news:#p**************@TK2MSFTNGP11.phx.gbl...
Thanks Peter,

This is inline with what I discovered in google however I am new to asp.net
and don't understand what this involves.
Does this mean including a including a html "Public" tag in the ascx or
similar ?

Thanks

Murphy

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uA**************@TK2MSFTNGP09.phx.gbl...
You have to wrap access to your form fields using properties or
methods,
or
make your form fields public.

"Murphy" <mu****@murphy.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
> I've read through the google posts on this topic and am still
unclear of the
> solution.
>
> Simply I have a user control that contains form controls and I would

like
to
> reference the values in the form from the aspx page that contains
the user
> control. The error message received is:
> Compiler Error Message: BC30390: 'ASP._userdetails_ascx.Company' is

not > accessible in this context because it is 'Protected'.
>
> Thanks
>
> Murphy
>
>



Nov 18 '05 #7

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

Similar topics

4
4496
by: Adriano Coser | last post by:
I'm getting the following error: error C3767: PictureSource - candidate function(s) not accessible when accessing a public member function of a managed class, either from managed or unmanaged...
6
1810
by: Murphy | last post by:
I've read through the google posts on this topic and am still unclear of the solution. Simply I have a user control that contains form controls and I would like to reference the values in the...
3
1936
by: Tim Zych | last post by:
If I declare a procedure in a webform as Public and attach it to a button in the same webform, it runs fine. If I change it to Private Sub and try to click it i get the error: ...
1
1184
by: Patrick.O.Ige | last post by:
Hi, I declared ItemTypes as:- Dim ItemTypes As New ArrayList Outside the Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load and have a function...
5
1163
by: Fred | last post by:
Following what I think are relevant portions of my code: ---------------Begin Code--------------------- Public Class LOLoadingBoard Inherits System.Web.UI.Page Dim MaxNum As Integer Dim LNToEd...
2
4403
by: Steven T. Hatton | last post by:
Can somebody explain why making T a friend of either B or C will permit the code to compile? class A{ protected: A(){} }; class T; class B: protected A {protected: B(){}/*friend class T;*/};...
14
2448
by: mlimber | last post by:
In an article on the safe bool idiom (http://www.artima.com/cppsource/safeboolP.html), Bjorn Karlsson gives the following code (slightly modified): class safe_bool_base { protected: typedef...
3
4281
by: eBob.com | last post by:
I'm getting this error on this statement ... Dim TA_rect As Rectangle = CType(Me.ClientRectangle.memberwiseclone(), Rectangle) "Me" inherits from UserControl. I'm not an OOD guru but maybe...
0
1167
by: flashleo | last post by:
A strange problem i am facing i bind DataList on link button Argument Event. <asp:DataList id="DataList2" runat="server" horizontalalign="Left" repeatdirection="Horizontal" repeatcolumns="3"...
0
7245
marktang
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,...
0
7356
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
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.