c# - nested property listbox -
i use ef , set datasource of bindingsource user.
now in listbox set valuemember asuserid , displaymember product.productname (nested property)
schemat is:
user _________ userid username productid product _________ productid productname
i bind lot of users control , display productnames there visible 1 productname though there example 4 users.
the classes generated ef partial, can create source file , add property user class, that:
public partial class user { public string productname { { return this.product.productname; } } }
this way not need access nested properties displaymember.
Comments
Post a Comment