Can I make controls defined in my markup public instead of protected
Posted
by RoboShop
on Stack Overflow
See other posts from Stack Overflow
or by RoboShop
Published on 2010-04-14T04:09:57Z
Indexed on
2010/04/14
4:13 UTC
Read the original article
Hit count: 354
Say I have a web site with a master page and an aspx page.
In my ASPX page, I am pointing to my masterpage with the MasterType tag.
<%@ MasterType VirtualPath="~/mymasterpage.master" %>
Say, I've defined a label in the markup of my master page.
If you look at the designer code, this label should be something like this.
protected global::System.Web.UI.WebControls.Label label1;
Now in my content page, I would like to reference this label. If I type in this "Master.label1", the complier will complain that the control is inaccessible due to the protection level" and rightly so, as label1 is automatically defined as "protected".
My question is, if I define controls in my markup page, is it possible to set these controls as public instead of protected? I do not see an attribute for it.
thanks in advance.
© Stack Overflow or respective owner