使用DataList进行3层编历

发表于:2007-06-30来源:作者:点击数: 标签:
asp:DataList enableViewState=false id=datalistMagCat runat=server RepeatColumns=1 Width=350 BorderColor=black BorderWidth=1 GridLines=Both CellPadding=3 Font-Name=Verdana Font-Size=8pt HeaderStyle-BackColor=#aaaadd AlternatingItemStyle-Back
        <asp:DataList enableViewState="false" id="datalistMagCat" runat="server" RepeatColumns="1" Width="350" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee" SelectedItemStyle-BackColor="yellow" OnItemCommand="DataList_ItemCommand" OnCancelCommand="DataList_CancelCommand" AllowPaging="True" PageSize="30" PagerStyle-Mode="NumericPages">
                            <SelectedItemStyle BackColor="Yellow"></SelectedItemStyle>
                            <HeaderTemplate>
                                目录
                                <br>
                                <div align="center">
                                    <asp:adRotator AdvertisementFile="advs/advs.xml" runat="server" BorderColor="#000000" BorderWidth="0" ID="Adrotator1" Target="_new"></asp:adRotator>
                                </div>
                            </HeaderTemplate>
                            <SelectedItemTemplate></SelectedItemTemplate>
                            <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
                            <ItemTemplate>
                                <asp:Lable id="lbCatTitleLevel1">
                                    <span class="cat1">
                                        <%# DataBinder.Eval(Container.DataItem, "CatTitle")%>
                                    </span>
                                </asp:Lable>
                                <asp:DataList enableViewState="false" id="datalistTest" datasource=@#<%# ShowSubCat((int)DataBinder.Eval(Container.DataItem,"MagID"),(int)DataBinder.Eval(Container.DataItem,"MagYear"), (int)DataBinder.Eval(Container.DataItem,"YearIssue"), (int)DataBinder.Eval(Container.DataItem,"CatID"))%>@# runat="server" RepeatColumns="1" Width="100%" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee" SelectedItemStyle-BackColor="yellow" OnItemCommand="DataList_ItemCommand" OnCancelCommand="DataList_CancelCommand" AllowPaging="True" PageSize="30" PagerStyle-Mode="NumericPages">
                                    <ItemTemplate>
                                          
                                        <asp:Lable id="lbCatTitleLevel2">
                                            <span class="cat2">
                                                <%# DataBinder.Eval(Container.DataItem, "CatTitle")%>
                                            </span>
                                        </asp:Lable>
                                        <asp:DataList enableViewState="false" id="Datalist1" datasource=@#<%# ShowSubCat((int)DataBinder.Eval(Container.DataItem,"MagID"),(int)DataBinder.Eval(Container.DataItem,"MagYear"), (int)DataBinder.Eval(Container.DataItem,"YearIssue"), (int)DataBinder.Eval(Container.DataItem,"CatID"))%>@# runat="server" RepeatColumns="1" Width="100%" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee" SelectedItemStyle-BackColor="yellow" OnItemCommand="DataList_ItemCommand" OnCancelCommand="DataList_CancelCommand" AllowPaging="True" PageSize="30" PagerStyle-Mode="NumericPages">
                                            <ItemTemplate>
                                                    
                                                <asp:Lable id="lbCatTitleLevel3">
                                                    <span class="cat3">
                                                        <%# DataBinder.Eval(Container.DataItem, "CatTitle")%>
                                                    </span>
                                                </asp:Lable>
                                                <asp:DataList enableViewState="false" id="datalistShowMagArtTitleLeve3" datasource=@#<%# ShowMagArtTitle((int)DataBinder.Eval(Container.DataItem, "ciID"))%>@# runat="server" RepeatColumns="1" Width="100%" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee" SelectedItemStyle-BackColor="yellow" OnItemCommand="DataList_ItemCommand" OnCancelCommand="DataList_CancelCommand" AllowPaging="True" PageSize="30" PagerStyle-Mode="NumericPages">
                                                    <ItemTemplate>
                                                            
                                                        <asp:LinkButton id="lbArtTitleLevel3" runat="server" Text=@#<%# DataBinder.Eval(Container.DataItem, "MainHeader")%>@# />
                                                    </ItemTemplate>
                                                </asp:DataList>
                                            </ItemTemplate>
                                        </asp:DataList>
                                        <asp:DataList enableViewState="false" id="datalistShowMagArtTitleLeve2" datasource=@#<%# ShowMagArtTitle((int)DataBinder.Eval(Container.DataItem, "ciID"))%>@# runat="server" RepeatColumns="1" Width="100%" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee" SelectedItemStyle-BackColor="yellow" OnItemCommand="DataList_ItemCommand" OnCancelCommand="DataList_CancelCommand" AllowPaging="True" PageSize="30" PagerStyle-Mode="NumericPages">
                                            <ItemTemplate>
                                                    
                                                <asp:LinkButton id="lbArtTitleLevel2" runat="server" Text=@#<%# DataBinder.Eval(Container.DataItem, "MainHeader")%>@# />
                                            </ItemTemplate>
                                        </asp:DataList>
                                    </ItemTemplate>
                                    
                                    
                                    
                                </asp:DataList>
                                <asp:DataList enableViewState="false" id="datalistShowMagArtTitleLeve1" datasource=@#<%# ShowMagArtTitle((int)DataBinder.Eval(Container.DataItem, "ciID"))%>@# runat="server" RepeatColumns="1" Width="100%" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee" SelectedItemStyle-BackColor="yellow" OnItemCommand="DataList_ItemCommand" OnCancelCommand="DataList_CancelCommand" AllowPaging="True" PageSize="30" PagerStyle-Mode="NumericPages">
                                    <ItemTemplate>
                                            
                                        <asp:LinkButton id="lbArtTitleLevel1" runat="server" Text=@#<%# DataBinder.Eval(Container.DataItem, "MainHeader")%>@# />
                                    </ItemTemplate>
                                </asp:DataList>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#AAAADD"></HeaderStyle>
                        </asp:DataList>

原文转自:http://www.ltesting.net