日期:2014-05-17 浏览次数:20445 次
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
BindItems();
}
protected void BindItems() //绑定分类
{
BGOA.App_Code.ItemsDal itemsDal = new App_Code.ItemsDal();
ItemsRepeater.DataSource = itemsDal.GetItemsListForIndex();
ItemsRepeater.DataBind();
}
protected DataTable BindNews(int itemsid) //根据分类ID,绑定新闻列表
{
BGOA.App_Code.NewsDal newsdal = new App_Code.NewsDal();
return newsdal.GetNewsForIndex(itemsid);
}
<asp:Repeater ID="ItemsRepeater" runat="server">
<ItemTemplate>
<div class="column">
<h3><%# Eval("ItemName") %><a href="#">更多</a></h3>
<ul>
<asp:Repeater ID="NewsRepeater" runat="server" DataSourceID='<%#BindNews(Convert.ToInt32(Eval("ItemID"))) %>'>
<ItemTemplate>
<li><%#Eval("NewsTitle") %></li>
</ItemTemplate>
&