简体   繁体   中英

How to access class object in aspx file from its code behind file

this is my class in some namespace

public class UserObject
{
     public int MasterManagement_roleid = 0;
}

This Class have instance declare in code behind file like this

public partial class ContractorManagement_MaterialReturn : System.Web.UI.Page
{
            UserObject objUser = new UserObject();
            protected void Page_Load(object sender, EventArgs e)
            {
                 \\some code
            }
}

And In my aspx file i have some thing like this

 <%if(objUser.MasterManagement_roleid.ToString().Trim().Equals("-1")){ %> // This line error comes always please help
              //some tags to be displayed     
    <%} %>

Error Is server application '/' some thing like this

您需要将objUser公开。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM