De vraag is simpel maar de oplossing denk ik niet.
Ik heb een gridview met een EntityDataSource.
Deze wil ik laten sorteren op een omschrijving en niet op een ID.
Gridview code:
<%# Eval("InspectionStatus.Description") %> werkt wel.
SortExpression="InspectionStatus.Description" werkt niet.
1 niveau hoger werkt wel SortExpression="InspectionStatusID"
EntityDataSource code:
Include="InspectionStatus" is noodzakelijk anders werkt eval ook niet.
Hoe krijg ik de sortering nu ook goed?
foutmelding:
'InspectionStatus.Description' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near multipart identifier, line 13, column 1.
Ik heb een gridview met een EntityDataSource.
Deze wil ik laten sorteren op een omschrijving en niet op een ID.
Gridview code:
ASP.NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
| <asp:GridView ID="grdvInspections" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="InspectionID" DataSourceID="InspectionsEDS"> <Columns> <asp:TemplateField HeaderText="Status" SortExpression="InspectionStatus.Description"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("InspectionStatus.Description") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> |
<%# Eval("InspectionStatus.Description") %> werkt wel.
SortExpression="InspectionStatus.Description" werkt niet.
1 niveau hoger werkt wel SortExpression="InspectionStatusID"
EntityDataSource code:
ASP.NET:
1
2
3
4
5
| <asp:EntityDataSource ID="InspectionsEDS" runat="server" ConnectionString="name=MESEntities" DefaultContainerName="MESEntities" EntitySetName="Inspections" Include="InspectionStatus"> </asp:EntityDataSource> |
Include="InspectionStatus" is noodzakelijk anders werkt eval ook niet.
Hoe krijg ik de sortering nu ook goed?
foutmelding:
'InspectionStatus.Description' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near multipart identifier, line 13, column 1.