I’m getting an error in .net when trying to declare a Public class on my code behind page.
Partial Class _Default Inherits System.Web.UI.Page Public someVariable as integer Public someClass as className Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...]
The error I’m getting is BC30508: 'someClass' cannot expose type 'className' in namespace '<Default>' through class '_Default'.
The goal here is accessing the class properties in script blocks on the aspx page like this <%=someClass.classProperty%>
I’m not sure if I’m trying the right methods (I’ve tried several ways of declaring the public class) or if it can even be done… Thanks for taking a look at it.
Check the protection level of your
classNametype. Did you forget to mark it public?That error message means you have something that is has restricted access, and you are trying to use it in a way that would allow access outside the restrictions. For example, if your
classNametype isinternalor aprivatechild class of_Default, but you add a public member of that type as a property your assembly would expose a type as part of it’s interface that is otherwise unusable.