私には3つのクラス(ドメイン、ロール、ユーザー)があります。ドメインとロールは、次のようにユーザークラスのプロパティです。
public int UserID { get; set; }
public string UserName { get; set; }
public Domain Domain { get; set; }
public Role Role { get; set; }
public bool Active { get; set; }
ドメインとロールには、IDプロパティとNameプロパティがあります。
ユーザーリストをグリッドビューにバインドしたいのですが、ドメイン名を表示しています。現在、次のようなバインドされたフィールドがあります。
<asp:BoundField DataField="Domain.DomainName" SortExpression="UserDomain" ReadOnly="True" HeaderText="User Domain" />
しかし、これは機能せず、休眠エラーが発生します。DataBinding: 'Yasur.Business.Entities.User' does not contain a property with the name 'DomainName'.
これを行うための最良の方法は何ですか?
ペドロ・デュッソ