1
我有一個列表視圖「CategoriesList」和我有一箇中繼「NewsRepeater」列表視圖「CategoriesList」裏面如何將父級ListView中的ID傳遞給子級Repeater在父級ListView內部?
<asp:ListView ID="CategoriesList" runat="server" DataKeyNames="CatID" DataSourceID="CategoriesListODS"
EnableModelValidation="True">
<EmptyDataTemplate>
No data was returned.
</EmptyDataTemplate>
<ItemSeparatorTemplate>
<div class="clear">
</div>
</ItemSeparatorTemplate>
<ItemTemplate>
<div class="head-Kuwait-University-news">
<h2>
<%# Eval("CatTitleAr")%>
</h2>
<asp:Literal ID="CatIDLtl" runat="server" Visible="false" Text='<%# Eval("CatID")%>' />
</div>
<!--End head Kuwait-University-newst-->
<asp:Repeater ID="NewsRepeater" runat="server" DataSourceID="NewsRepeaterODS">
<ItemTemplate>
<div class="content-Kuwait-University-news">
<div class="photo-Kuwait-University-news">
<a href="Items.aspx?ItemID=<%# Eval("ItemID")%>">
<img src="admin/ImageUpload/Items/<%# Eval("PictureID") %>.jpg" alt="" style="max-height: 141px;
max-width: 152px" />
</a>
</div>
<!--End photo-Kuwait-University-news-->
<div class="title-Kuwait-University-news">
<p>
<%# Eval("ItemTitleAr")%>
</p>
</div>
<!--End title-Kuwait-University-news-->
<div class="News-Kuwait-University-news">
<p>
<%# Eval("SDescriptionAr")%>
</p>
</div>
<!--End news-Kuwait-University-news-->
<div class="clear">
</div>
<div class="more-Kuwait-University-news">
<a href='Item.aspx?ItemID=<%# Eval("ItemID")%>'>
<img src="images/more.jpg" alt="" />
</a>
</div>
<!--End more-Kuwait-University-news-->
<div class="clear">
</div>
</div>
<!--Endcontent-Kuwait-University-news-->
<!--End category-->
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="NewsRepeaterODS" runat="server" OldValuesParameterFormatString="{0}"
SelectMethod="Read" TypeName="Items">
<SelectParameters>
<asp:Parameter DefaultValue="3.5" Name="ActionCode" Type="String" />
<asp:Parameter Name="CatID" Type="Int64" DefaultValue='<%# Eval("CatID")%>' />
<%--<asp:ControlParameter ControlID="CategoriesList" Name="CatID" PropertyName="UniqueID" Type="Int64" />--%>
<asp:Parameter Name="ItemsID" Type="Int64" />
<asp:Parameter Name="Searchtext" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<!--End category-->
</ItemTemplate>
<LayoutTemplate>
<ul id="itemPlaceholderContainer" runat="server" style="">
<li runat="server" id="itemPlaceholder" />
</ul>
<div style="">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
</asp:ListView>
<asp:ObjectDataSource ID="CategoriesListODS" runat="server" OldValuesParameterFormatString="{0}"
SelectMethod="Read" TypeName="Categories">
<SelectParameters>
<asp:Parameter DefaultValue="3" Name="ActionCode" Type="String" />
<asp:Parameter Name="CatID" Type="Int64" />
<asp:Parameter Name="Searchtext" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
如何從列表視圖通過CATID並使其在ObjectDataSource控件「NewsRepeaterODS」 SelectParameters?
感謝
你有沒有看到這個問題? :http://stackoverflow.com/questions/491537/nested-repeaters-and-sqldatasource-parameters –
嘿謝謝,那就是我一直在尋找 – HAJJAJ