what is the default access modifier for controls created on .aspx page. Private or something else?
What is the default access modifier for controls created on .aspx page. Private or something 开发者_如何学Celse?
its 'protected'.
N
protected
If you open the MyPage.aspx.designer.cs (or MyPage.aspx.designer.vb) you can see the declarations for the controls.
I believe the controls on the aspx as considered protected by default and any methods in the code behind (.aspx.cs or aspx.vb) are private by default. You can expose those controls by adding a public page property if you need to access it.
精彩评论