Sorting on related entities

Posts   
 
    
JohnnyO
User
Posts: 1
Joined: 27-Aug-2007
# Posted on: 27-Aug-2007 22:36:18   

I'm using LLBLGenProDataSource2 to bind an EntityCollection to a gridview. I'm having trouble getting the sorting to work on the columns of the related objects. I'm using server side sorting, and setting the prefetch path in the code behind, as well as the label text in the row data bound. All of the columns bind, and the columns of the main entity sort properly, but the 3 relational entities are not sorting (Form Name, Last Name, and First Name). Any suggestions?

HTML



<asp:GridView 
                ID="gvRequestList" 
                CssClass="GridStyle" 
                runat="server" 
                DataSourceID="RequestDS"
                BorderWidth="0px" 
                BorderColor="#E5E5E5" 
                PageSize="20" 
                AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" 
                GridLines="None" 
                CellPadding="3" 
                OnRowDataBound="gvRequestList_RowDataBound" 
                
                width="600">
                    <Columns>
                        <asp:TemplateField HeaderText="Form Name" SortExpression="ReqForm.WebFormName">
                            <ItemTemplate>
                                <asp:Label ID="lblFormName" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Last Name" SortExpression="ReqRespondent.LastName">
                            <ItemTemplate>
                                <asp:Label ID="lblLastName" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="First Name" SortExpression="ReqRespondent.FirstName">
                            <ItemTemplate>
                                <asp:Label ID="lblFirstName" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Date Received" SortExpression="DateReceived">
                            <ItemTemplate>
                                <asp:Label ID="lblDateReceived" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Estimated Date" SortExpression="EstDateToComplete">
                            <ItemTemplate>
                                <asp:Label ID="lblEstDateComplete" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    
                    </Columns>
                    <EmptyDataTemplate>
                        There were no requests found to display.
                    </EmptyDataTemplate>
                </asp:GridView>

Thanks, John

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Aug-2007 05:33:20   

Hi John,

Could you please post the aspx of the LLBLGenProDatasource2?

Also, in this cases is recommended to use "fields mapped on related fields" (LLBLGenPro designer) so would be easy make the sorting work.

Also read thread that is related to your question: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=9288

Regards,

David Elizondo | LLBLGen Support Team