Protected
Protected means that elements are accessible only from within their own
class or from a derived class. Protected can also be used with the Friend
keyword. When they're used together, elements are accessible from the same
assembly, from their own class, and from any derived classes.
in "Code Front"
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
Inhertis the code behind page so when you declare protected then you can use
it.
You can do Public but do you really want too?? NOT.
SA
"zhuang" <zh********@caudwellcommunications.co.uk> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
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