烈火网(LieHuo.Net)教程 Repeater嵌套
以下为引用的内容: <asp:Repeater ID="rptSubCategoryList" runat="server"> <ItemTemplate> <tr> <td > <%# Eval("CategoryName")%></td> </tr> <asp:Repeater ID="rptSubCategoryListSub" runat="server" DataSource='<%# DataBind(Convert.ToInt32( Eval("ID") )) %>'> <ItemTemplate> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <%#reqID == Convert.ToInt32(Eval("ID"))%> </td> </tr> </table> </td> </tr> </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:Repeater>
/**//// <summary> /// 绑定到Repeater /// </summary> protected void DataBind<T>(Repeater rep, List<T> lstCategory) { rep.DataSource = lstCategory; rep.DataBind(); }
/**//// <summary> /// 绑定到子Repeater /// </summary> /// <param name="categoryId"></param> /// <returns></returns> protected List<ContentInfo.Get_Content> DataBind(int categoryId) { List<ContentInfo.Get_Content> lstContent = new ContentAgent().Get_List(categoryId); return lstContent; }
|