Re: User control visibility

Adam Tuliper <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <00fe01c736b8$c7494a60$55dbdf20$@com>
Ideally Mark for 'good' design, you should include a property to get/set the
text if all you want is to change the text.


-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Efran Cobisi
Sent: Friday, January 12, 2007 1:04 AM
To: [email protected]
Subject: Re: [DOTNET-WEB] User control visibility

Hi Mark,

In ASP.NET version 2.0 compilation model, controls like this one are
built in the containing control type as protected members and their
visibility could not be changed.
I discourage trying to break this behavior but, if you really need to,
you can break the encapsulation of the former control and let users
access the latter using  a public property like this one (C# code):

// Assuming your inner textbox is named "txtInnerTextBox"

public TextBox InnerTextBox
{
    get
    {
       return txtInnerTextBox;
    }
}

HTH

Efran Cobisi
http://www.cobisi.com

Mark Aurit wrote:
> I have a textbox control in a user control.  In 1.1 I was able to access
> its .text property from the calling page by changing the protection
> level of the control in the .ascx from protected to public.
> How does one do the same thing in 2.0, since they are not able (at least
> Im not able!) to touch the protection level?
> Thanks, Mark
>
>
> ====================
> Mark Aurit
> [email protected]
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.