Thank you for that information that worked for the above problem. Now I have another related problem regarding Sorting a gridview on a mapped field. Sorting works for everything else. Here is my code then below.
I want to be able to sort installing tech, status, and company name. installing tech, and status work but company name is a related field, doesn't work
The gridview
<asp:GridView ID="requestGV" runat="server" AutoGenerateColumns="False"
DataKeyNames="Rrid" DataSourceID="requestDS_A" AllowSorting="True" SkinID="light">
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Crid" HeaderText="Crid" InsertVisible="False" ReadOnly="True" />
<asp:BoundField DataField="CustomerName" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Rrid" HeaderText="Rrid" ReadOnly="True" InsertVisible="False" />
<asp:BoundField DataField="FullName" HeaderText="Sales Rep" />
<asp:BoundField DataField="SubmittedDate" HeaderText="SubmittedDate" />
<asp:BoundField DataField="DeliveryDate" HeaderText="DeliveryDate" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:BoundField DataField="OldStatus" HeaderText="OldStatus" />
<asp:BoundField DataField="SurveyCompletelInitials" HeaderText="SurveyCompletelInitials" />
<asp:BoundField DataField="SurveyCompleteDate" HeaderText="SurveyCompleteDate" />
<asp:BoundField DataField="InstallTechnician" HeaderText="InstallTechnician" SortExpression="InstallTechnician" />
<asp:BoundField DataField="InstallTime" HeaderText="InstallTime" />
</Columns>
</asp:GridView>
and the perform select on datasource.
'perform select is used by the llblgen datasource to bind data found in the database to the control
Sub requestDS_A_PerformSelect(ByVal sender As Object, ByVal e As PerformSelectEventArgs2) Handles requestDS_A.PerformSelect
Dim bucket As New RelationPredicateBucket()
bucket.Relations.Add(New EntityRelation(RequestFields.Crid, CustomerFields.Crid, RelationType.ManyToOne))
Dim prefetchPath As IPrefetchPath2 = New PrefetchPath2(CType(EntityType.RequestEntity, Integer))
prefetchPath.Add(RequestEntity.PrefetchPathEmployeesOmd)
prefetchPath.Add(RequestEntity.PrefetchPathCustomer)
Using adapter As New DataAccessAdapter()
'Refresh entities in container
adapter.FetchEntityCollection(requestDS_A.EntityCollection, bucket, 0, e.Sorter, prefetchPath, e.PageNumber, e.PageSize)
End Using
End Sub