Hi there,
You are very close. Below I resume two solutions to your scenario:
DynamicList approach
// prepare field
ResultsetFields fields = new ResultsetFields(1);
fields.DefineField(EnhancedPcnCaptureMgrFields.Caplname, 1, "FullName");
fields[0].ExpressionToApply = new DbFunctionCall("{0} + ' ' + {1}", new object[] {
EnhancedPcnCaptureMgrFields.Capfname,
EnhancedPcnCaptureMgrFields.Caplname });
// fetch
DataTable results = new DataTable();
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, results, 0, null, null, null, true, null, null, 0, 0);
// bind
lstApprover.DataSouce = results;
lstApprover.DataBind();
Using this expression instead of DBFunctionCall should work as well:
new Expression(
new Expression( EnhancedPcnCaptureMgrFields.Capfname, ExOp.Add, " "),
ExOp.Add,
EnhancedPcnCaptureMgrFields.Caplnam)
Entity Collection approach
And, you also could go on the collection approach. You just need to add a custom property to your entity (in a partial class or custom code region):
public string FullName
{
get
{
return this.Capfname + " " + this.Caplname;
}
}
then, at your gui code, fetch the collection and bind it:
//fetch
EnhancedPcnCaptureMgrCollection myColl = new EnhancedPcnCaptureMgrCollection();
myColl.GetMulti(null);
//bind
lstApprover.DataSouce = myColl;
lstApprover.DataMember = "FullName";
lstApprover.DataBind();