Rudra Sisodia
Rudra Sisodia

Reputation: 133

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

Upvotes: 1

Views: 2238

Answers (1)

Andrei Bozantan
Andrei Bozantan

Reputation: 3921

You need to make objUser public.

Upvotes: 3

Related Questions