We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

access level for server control and user control

Thread ID:

Created:

Updated:

Platform:

Replies:

41361 Feb 28,2006 08:35 AM Mar 1,2006 04:01 AM ASP.NET Web Forms (Classic) 2
loading
Tags: FAQ
zhuang.lui@caudwellcommunications.co.uk
Asked On February 28, 2006 08:35 AM

When we drag and drop any server control from toolbox to web form, the relevant control is added to code-behind automatically with access level to be protected. When we drag and drop a user control to a web form, if we want to use that user control in code-behind, then we need to declare it to be protected as well, otherwise it will not work properly, why??? I never pay attention to this untill I start to work with user control. Thanks zhuang

Administrator [Syncfusion]
Replied On February 28, 2006 10:32 AM

Hi, A nice question, I think the reason should be because "just a guess only" The controls are just reusable classes(the benefit of object oriented concept), and ofcourse the full usage of object oriented features are applied in reusable classes only. So we are in need of a object to refer this classes. But why do we need protected? still confuses but this should be again regarding the protection level is intermediate I guess because if any one wants to use it inside the application or page , they can use the control and the chances of breaking the control outside the application should be avoided , so finally that too makes sense i guess , being protected. If any one have a nice Blogs/discussion on this please post. -Hari

zhuang.lui@caudwellcommunications.co.uk
Replied On March 1, 2006 04:01 AM

Thanks, I have posted the same question on other forums, I will keep this post updated once new answers come in.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;