Inherited properties aren't bound during databinding

Posted by Josh on Stack Overflow See other posts from Stack Overflow or by Josh
Published on 2010-04-01T21:16:21Z Indexed on 2010/04/01 21:23 UTC
Read the original article Hit count: 353

Filed under:
|
|
|

I have two interfaces, IAuditable and ITransaction.

public interface IAuditable{
    DateTime CreatedOn { get; }
    string CreatedBy { get; }
 }

public interface ITransaction : IAuditable {
    double Amount{ get; }
} 

And a class that implements ITransaction, call Transaction.

public class Transaction : ITransaction{
    public DateTime CreatedOn { get { return DateTime.Now; } }
    public string CreatedBy { get { return "aspnet"; } }
    public doubl Amount { get { return 0; } }
}

When I bind a list of ITransactions to a datagrid and use auto create columns, only the Amount gets bound. The CreatedBy and CreatedOn are not seen. Is there a way I can get these values visible during databinding?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms