开发者

Cannot get databinding to work

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; 
        }  
    } 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜