好的,我已经看到很多关于在嵌套列表视图中访问父列表视图的问题,但没有人回答我的问题。
为什么我不能访问第一个列表视图的某些属性并将其发送到第二个?我尝试了很多不同的属性,但没有一个工作。ItemPlaceHolder 或只是 User_Category 呢?我的想法是使用两个 ObjectDataSoureces 并将 DataKeyName 从父列表视图发送到第二个 ObjectDataSource。但我不知道如何获取 DataKeyName(参见下面的 ????)
<asp:ListView ID="ListView1" runat="server"
DataSourceID="srcGetOrderForm"
DataKeyNames=User_Category
ItemPlaceholderID="lvItemPlaceHolder">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="lvItemPlaceHolder" />
</LayoutTemplate>
<ItemTemplate>
<asp:Panel runat="server" ID="panelCustomerInfo"
cssclass="collapsePanelHeaderForFilter">
<%# Eval("User_Category")%>
</asp:Panel>
<asp:panel runat="server" ID="panelCustomerDetails"
cssclass="collapsePanelForFilter">
<asp:ListView ID="ListView2" runat="server"
DataSourceID="srcGetOrderForm2"
ItemPlaceholderID="lvOrdersItemPlaceHolder">
<LayoutTemplate>
<ul>
<asp:PlaceHolder runat="server"
ID="lvOrdersItemPlaceHolder" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li>
Description: <%# Eval("Description")%>
</li>
</ItemTemplate>
</asp:ListView>
</asp:panel>
</ItemTemplate>
</asp:ListView>
<asp:ObjectDataSource
ID="srcGetOrderForm"
TypeName = "ABC.Products"
SelectMethod = "NewGetOrderFormCategories"
runat="server" >
<SelectParameters>
<asp:ProfileParameter Name="User" PropertyName="User_ID" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource
ID="srcGetOrderForm2"
TypeName = "ABC.Products"
SelectMethod = "NewGetOrderFormCategoryItems"
runat="server" >
<SelectParameters>
<asp:ProfileParameter Name="User" PropertyName="User_ID" />
<asp:ControlParameter ControlID="ListView1" Name="User_Category" PropertyName=???? />
</SelectParameters>
</asp:ObjectDataSource>