I would like to use the ISortExpression to sort a Collection on a related table. Is this possible? When I try to do this, I get a " The multi-part identifier can not be bound".
Backgroud:
The "EnterpriseUser" class is a global user we use for all applications. "TmsUser" is a user of one of our sub-systems, and is related to "EnterpriseUser" via UserID's (EnterpriseUser.UserId = TmsUser.UserId). I have a custom relationship setup that links these two together in LLBLGen. Since the EnterpriseUser contains last name, and TmsUser only contains the UserId, I want to sort a collection of TmsUsers by EnterpriseUser.LastName. The below code does not work, but maybe you could provide me with a workaround to acheive this goal...Any help is greatly appreciated.
Below is my code.
List<TMSUser> lstTMSUsers = new List<TMSUser>();
_tmsUserCollection = new TmsUsersCollection();
// filter statement
IPredicateExpression filter = new PredicateExpression();
filter.Add(new FieldCompareValuePredicate(
TmsUsersFields.IsTimeApprover, ComparisonOperator.Equal, true));
if (enumActiveStatus != TmsActiveStatus.All)
{
bool activeStatus = Convert.ToBoolean(enumActiveStatus);
filter.AddWithAnd(new FieldCompareValuePredicate(
TmsUsersFields.IsActive, ComparisonOperator.Equal, activeStatus));
}
// sort statement - here is where it bombs
[b]ISortExpression sortBy = new SortExpression([u]EnterpriseUserFields.LastName [/u]| SortOperator.Ascending);[/b]
_tmsUserCollection.GetMulti(filter, 0, sortBy);