I am having difficulty binding to a property on my object.
This is my property:
private int? Tid;
private int? innerTenantID {
get { return Tid; }
set {
Tid = value;
innerTenant = (value.HasValue)? Tenant.GetTenantByID(value.Value) : null;
} 开发者_如何学JAVA
}
And this is my attempt to bind:
this.DataBindings.Add(new Binding("innerTenantID", tblCashReceiptsBindingSource, "TenantID"));
I get, ArguementException, "Cannot bind to the Property 'innerTenantID' on the target control. Prameter name: PropertyName;
The TenantID value is a nullable integer.
The first thing I see, is that the getter and setter is not public. Probably this is the problem.
private int? Tid;
public int? innerTenantID {
get { return Tid; }
set {
Tid = value;
innerTenant = (value.HasValue)? Tenant.GetTenantByID(value.Value) : null;
}
}
精彩评论