ASP.NET Forums
首页 搜索 用户列表 FAQ 注册 登录  
ASP.NET Forums » .Net 专区 » 组件/服务器控件开发 » 在Repeater控件中嵌套一个Repeater控件
  在Repeater控件中嵌套一个Repeater控件
帖子发起人: Leonic   发起时间: 2005-6-4 5:53 PM   回复数: 2
« 上一主题 下一主题 »
楼主
  2005-6-4, 5:53 PM
Leonic 离线,最后访问时间: 12/7/2007 6:30:38 PM Leonic



发帖数前10位
男

旅长
等级: 旅长
注册: 2005年3月27日
区域: 湖南长沙
积分: 584
精华: 1
发贴: 498
在Repeater控件中嵌套一个Repeater控件
 
前段时间做的电子商务网站,显示报表数据时想到的。

<
table style="BORDER-TOP: #42adf1 1px outset" cellSpacing="1" cellPadding="1" width="100%"  align="center" border="0">
 3                                        <tr>
 4                                            <td class="column" width="5%" height="20"></td>
 5                                            <td class="column" nowrap width="30%">cell</td>
 6                                            <td class="column" nowrap width="30%">cell</td>
 7                                            <td class="column" nowrap width="20%">cell<td>
 8                                            <td class="column" nowrap width="20%">cell</td>
 9                                        </tr>
10                                        <script runat="server">
11                                            int l = 1;
12                                        
</script>
13                                        <asp:repeater id="repeaterCollection" runat="server">
14                                            <ItemTemplate>
15                                                <asp:Literal ID ="NoneResource" Runat=server></asp:Literal>
16                                                <tr class="f2">
17                                                    <td align="right">&nbsp;<%=l++%>
18                                                        .&nbsp;</td>
19                                                    <td nowrap height="20">
20                                                        <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
21                                                            <TR>
22                                                                <TD align="left" width="90%" nowrap><%#DataBinder.Eval(Container.DataItem,"city")%></TD>
23                                                                <TD align=right nowrap><onmousedown="AreaDetailsOnOff('AreaDetails<%=l%>')" style="cursor:hand"> &raquo;&raquo;</a></td>                                                    
24                                                            </TR>
25                                                        </TABLE>
26                                                    </TD>
27                                                    <td nowrap>
28                                                        <%#DataBinder.Eval(Container.DataItem,"name")%>
29                                                    </td>
30                                                    <td nowrap>
31                                                        <%# SalesReport.GetProductSalesTotalNum(DataBinder.Eval(Container.DataItem,"DealerID").ToString())%>
32                                                    </td>
33                                                    <td nowrap>
34                                                        <%# SalesReport.GetProductSalesWorth(DataBinder.Eval(Container.DataItem,"DealerID").ToString())%>
35                                                        <%# SalesReport.SetDealerID(DataBinder.Eval(Container.DataItem,"DealerID").ToString())%>
36                                                    </td>
37                                                </tr>
38                                                <tr class="f2">
39                                                    <td></td>
40                                                    <td colspan=4 height=1>
41                                                        <DIV id="AreaDetails<%=l%>" style="DISPLAY: none;">
42                                                            <table cellSpacing="1" cellPadding="0" border=0 width="100%" align=center class="tableBorder">
43                                                                <tr>
44                                                                    <td class="child" width="5%" height="12"></td>
45                                                                    <td class="child" nowrap width="25%">&nbsp;cell</td>
46                                                                    <td class="child" nowrap width="22%">&nbsp;cell</td>
47                                                                    <td class="child" nowrap width="22%">&nbsp;cell</td>
48                                                                    <td class="child" nowrap width="22%">&nbsp;cell</td>
49                                                                </tr>                                                        
50                                                                <script language=C# runat=server>
51                                                                    int i = 1;
52                                                                
</script>
53                                                                <CT:MyRepeater id="myRepeater" runat="server">        
54                                                                    <ItemTemplate>
55                                                                        <asp:Literal ID ="nonetotalprod" Runat=server></asp:Literal>
56                                                                        <tr class="f2">
57                                                                            <td>&nbsp;<%= i++ %>.&nbsp;</td>
58                                                                            <td nowrap height="2">
59                                                                                <%#DataBinder.Eval(Container.DataItem,"PName")%></a></td>
60                                                                            <td nowrap>
61                                                                                <%#DataBinder.Eval(Container.DataItem,"quantity")%>
62                                                                            </td>
63                                                                            <td nowrap>
64                                                                                <%#DataBinder.Eval(Container.DataItem,"UnitPrice")%>
65                                                                            </td>
66                                                                            <td nowrap>
67                                                                                <%#SalesSchemeTrack.SetTotalPrice(DataBinder.Eval(Container.DataItem,"quantity").ToString(),DataBinder.Eval(Container.DataItem,"UnitPrice").ToString(),DataBinder.Eval(Container.DataItem,"DiscPercent").ToString())%>
68                                                                            </td>
69                                                                        </tr>
70                                                                    </ItemTemplate>
71                                                                </CT:MyRepeater>
72                                                            </table>
73                                                        </div>
74                                                    </td>
75                                                </tr>
76                                            </ItemTemplate>
77                                        </asp:repeater>
78                                        <tr class="f2">
79                                            <td align="right" colSpan="9">
80                                                <TABLE class="tableborder" cellSpacing="0" cellPadding="0" border="0">
81                                                    <TR>
82                                                        <TD><asp:label id="pageindex" runat="server" CssClass="pageIndex"></asp:label></TD>
83                                                    </TR>
84                                                </TABLE>
85                                            </td>
86                                        </tr>
87                                    </table>
88                                </TD>
89                            </TR>
90                        </table>
91                    </td>
92                </tr>
93            </TABLE>
<script language=""javascript>
function AreaDetailsOnOff (menuName) {
    menu = document.getElementById(menuName);
    if (menu.style.display == 'none') {
      menu.style.display = 'block';
    } else {
      menu.style.display = 'none';
    }
}
</script>

详细请见http://www.cnblogs.com/qingyang/archive/2005/05/24/161611.html 
js是参照ANF的。

IP 地址: 已登录   来自: 已登录    返回顶部
第 2 楼
  2005-6-20, 9:23 PM
lsmwell 离线,最后访问时间: 1/27/2007 3:39:23 PM lsmwell



发帖数前500位

士兵
等级: 士兵
注册: 2005年5月6日
积分: 14
精华: 0
发贴: 13
Re: 在Repeater控件中嵌套一个Repeater控件
 
注意到是不错~~!
IP 地址: 已登录   来自: 已登录    返回顶部
第 3 楼
  2005-6-22, 12:42 PM
Leonic 离线,最后访问时间: 12/7/2007 6:30:38 PM Leonic



发帖数前10位
男

旅长
等级: 旅长
注册: 2005年3月27日
区域: 湖南长沙
积分: 584
精华: 1
发贴: 498
Re: 在Repeater控件中嵌套一个Repeater控件
 
DataGrid也可同样方法实现。