c# - Code Behind ASPX Page can see the Classes in AppCode but not their properties -
my code behind can see classes in appcode file none of attributes/variables/properties of classes.
i have set classes compile. variables , classes public. have tried adding using 'project'.appcode top. incredibly frustrating.
i have copy pasted alot of code project ensure it's not configuration issue.
my code behind page can see classes. doesn't know of them have properties. instantiating new 1 uses blank constructor when there isn't one.
for example, within appcode folder customer class.
public class customer { public string fname { get; set; } public string lname { get; set; } public string address { get; set; } public string city { get; set; } public province prov { get; set; } public string pcode { get; set; } public string email { get; set; } public list<phonenumber> pnums { get; set; } public list<pet> pets { get; set; } public string efname { get; set; } public string elname { get; set; } public phonenumber epnum { get; set; } public string eemail { get; set; } public customer(string fname, string lname, string address, string city, province prov, string pcode, string email, list<phonenumber> pnums, list<pet> pets, string efname, string elname, phonenumber epnum, string eemail) { this.fname = fname; this.lname = lname; this.address = address; this.city = city; this.prov = prov; this.pcode = pcode; this.email = email; this.pnums = pnums; this.pets = pets; this.efname = efname; this.elname = elname; this.epnum = epnum; this.eemail = eemail; } }
in code behind can see , instantiate class, uses blank constructor. cannot view of public variables have declared.
customer customer = new customer(); customer.pets.add(new pet());
spits out error
"error 2 'project.customer' not contain definition 'pets' , no extension method 'pets' accepting first argument of type 'project.customer' found (are missing using directive or assembly reference?)"
you need initialize pet list customer.
customer customer = new customer(); customer.pets = new list<pet>(); customer.pets.add(new pet());
Comments
Post a Comment