Hi
I am using version 2.5 and I am trying to get my LLBLGenProDataSource2 datasource to sort by a field from a related table, included in the prefetch path.
Code in front
<llblgenpro:llblgenprodatasource2 id="_CommentsGeneralDS" runat="server" adaptertypename="Model.DatabaseSpecific.DataAccessAdapter, ModelDBSpecific"
datacontainertype="EntityCollection" entityfactorytypename="Model.FactoryClasses.GenCommentEntityFactory, Model" >
</llblgenpro:llblgenprodatasource2>
Code behind
protected void Page_Load(object sender, EventArgs e)
{
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.GenCommentEntity);
prefetchPath.Add(GenCommentEntity.PrefetchPathPriorityCategory);
_CommentsGeneralDS.PrefetchPathToUse = prefetchPath;
SortExpression sort = new SortExpression();
//sort.Add(PriorityCategoryFields.OrderPosition | SortOperator.Descending);
sort.Add(GenCommentFields.CreationDate | SortOperator.Descending);
_CommentsGeneralDS.SorterToUse = sort;
_CommentsGeneralDS.Refetch = true;
}
But if I uncomment the addition of the first sort parameter the sql statement fails because the PriorityCategory table is not included in the sql FROM clause. I have been searching online for the last 2 hours for the correct way to do this but have found nothing. I would like to avoid sorting the gridview's items manually if I can and any help is most appreciated.
thanks in advance for any tips
XOR