If we want to bind list of objects to datagridview using coding ,we can do that by using
the following approach :-
For e.g:- If we have list of custom class that we want to bind to datagridview
List<ClassName> searchList;
this.transactiondataGridView.DataSource = searchList.Select(x => new
{
x.TrustAccount.Code,
x.Amount,
x.Payor,
x.SettlementDate,
x.PropertyAddress,
x.Borrower
}).ToList();
the following approach :-
For e.g:- If we have list of custom class that we want to bind to datagridview
List<ClassName> searchList;
this.transactiondataGridView.DataSource = searchList.Select(x => new
{
x.TrustAccount.Code,
x.Amount,
x.Payor,
x.SettlementDate,
x.PropertyAddress,
x.Borrower
}).ToList();
No comments:
Post a Comment