473,749 Members | 2,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing page control protection level

Hi

I'm developing an ASP.NET app in Visual studio (using C# for code behind). My question is fairly simple (i think). When I go to the code behind page, the controls in the html page are made "protected" so that it can only be accessed from within that page.

I would like to permanently make this "public" for certain controls, so that I can access them from another page (the page that a user control is embedded into for example). If I manually change it, it is fine but when I change something on the HTML page for a control, it reverts back to "protected" . It's a real pain continually changing this back to "public", especially since I have quite a few user controls now. I'm assuming that it is Visual Studio that is implementing this annoying quirk. Any help would be appreciated

Regards,
Nov 16 '05 #1
1 3380
You should create public properties in you code behind class that expose
the controls you want:

protected Control someControl;

public Control SomeControl
{
get { return someControl; }
}

VS won't mess with the properties you declare yourself, and then you
don't have to worry about it changing the protection level of the
controls that it creates.

-Jason

Jaweed wrote:
Hi,

I'm developing an ASP.NET app in Visual studio (using C# for code behind). My question is fairly simple (i think). When I go to the code behind page, the controls in the html page are made "protected" so that it can only be accessed from within that page.

I would like to permanently make this "public" for certain controls, so that I can access them from another page (the page that a user control is embedded into for example). If I manually change it, it is fine but when I change something on the HTML page for a control, it reverts back to "protected" . It's a real pain continually changing this back to "public", especially since I have quite a few user controls now. I'm assuming that it is Visual Studio that is implementing this annoying quirk. Any help would be appreciated.

Regards,

Nov 16 '05 #2

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

Similar topics

4
1423
by: CW | last post by:
I just took an extensive ASP.NET course and copied my projects to my wwwroot folder and tried opening my default page which consumes some web service. It worked ok at the course but now I get this error: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. ...
2
14802
by: DartmanX | last post by:
I doubt this is possible, but I want to ask, just in case it is. I have a project going using Google Maps. This project spits out an HTML page template for people to post to their website and display a map. Most of the people doing this will have limited knowledge of HTML. I want to ensure that this page remains an XHTML 1.0 Transitional (or Strict) page, in case some newbie removes the DOCTYPE or some slightly more knowledgeable tries...
1
3350
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new ImageClickEventHandler(this.save_click); This ImageButton is added to a dynamic table which is also
4
1978
by: SB | last post by:
Hi I'm trying to get forms-based authentication to authenticate different users for differet pages, like this: <configuration> <location path="Member" allowOverride="true"> <system.web> <authorization> <!-- allow tags must be first --> <allow users="Admin"/>
3
1561
by: Eric Sabine | last post by:
I've created a custom control (ascx) which contains a tree view, a drop down list, and a listbox. The custom control is included in a web form and at runtime, won't compile (I get the "inaccessible due to its protection level" error) because the NodePopulate event of the treeview is set to private. So I changed it to "protected" and the app compiles fine and runs and properly reacts to the event. Good. The problem is inside that...
8
2246
by: Edward Mitchell | last post by:
I have a main project that is protected in that the user is directed to a login.aspx file. The text in the web.config file is: <authentication mode="Forms"> <forms loginUrl="Login.aspx" /> </authentication> <authorization>
3
2397
by: xenophon | last post by:
This following innocuous code: System.IO.DirectoryInfo fff = new System.IO.DirectoryInfo(); System.IO.FileInfo ppp = fff.GetFiles( Request.MapPath(".") ); for( int ccc=0 ; ccc < ppp.Length ; ccc++ ) { System.Web.HttpResponse.Response.Write( "<a href=\"" + Request.MapPath(".") + "/" + HttpUtility.HtmlEncode(ppp.Name) + "\">link</a>" );
2
4069
by: Rob | last post by:
Hi Gang: I have a page that loads a remote page into an IFRAME. I don't have any control over this remote page though the page is owned by the same company I work for. The problem is that all of the pages have <base target='_parent'> specified -- so every link will bust out of the IFRAME. One solution I thought of was to load the page via a server side language,
3
1833
by: Goh | last post by:
Dear all, I would like to know how you guy people control your commercial program that is written in .Net Framework. As I know Microsoft implement a lot of security feature that help to secure our program not only for authentication but not mention about license control for what developer has been develop. Do you people know where can I find the source like article and sample source code even Open Source Library that do license...
0
8833
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.