The entity property has just been added so that you could access the child collection this way:
<data:ProductsRepeater runat="server" ID="rptProducts" DataSourceID="ProductsDataSource">
<HeaderTemplate>
<table border="1">
<tr>
<td>Product Id</td>
<td>Product Name</td>
<td>Category</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Container.CategoryId %></td>
<td><%# Container.ProductName %></td>
<td><%# Container.Entity.CategoryIdSource.CategoryName %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</data:ProductsRepeater>
<data:ProductsDataSource ID="ProductsDataSource" runat="server"
SelectMethod="GetAll"
EnablePaging="True"
EnableSorting="True"
EnableDeepLoad="True"
>
<DeepLoadProperties Method="IncludeChildren" Recursive="False">
<Types>
<data:ProductsProperty Name="Categories"/>
</Types>
</DeepLoadProperties>
</data:ProductsDataSource>
<data:ProductsRepeater runat="server" ID="rptProducts" DataSourceID="ProductsDataSource">
<HeaderTemplate>
<table border="1">
<tr>
<td>Product Id</td>
<td>Product Name</td>
<td>Category</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Container.CategoryId %></td>
<td><%# Container.ProductName %></td>
<td><%# Container.Entity.CategoryIdSource.CategoryName %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</data:ProductsRepeater>
<data:ProductsDataSource ID="ProductsDataSource" runat="server"
SelectMethod="GetAll"
EnablePaging="True"
EnableSorting="True"
EnableDeepLoad="True"
>
<DeepLoadProperties Method="IncludeChildren" Recursive="False">
<Types>
<data:ProductsProperty Name="Categories"/>
</Types>
</DeepLoadProperties>
</data:ProductsDataSource>
浙公网安备 33010602011771号