注册 登录
编程论坛 ASP.NET技术论坛

高手近来看看,这个问题怎么解决!!

lange2741 发布于 2008-04-25 12:31, 982 次点击
以下是代码:     
   <asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource5" OnItemCommand="Repeater1_ItemCommand">
        <ItemTemplate >
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
            <tr>
                <td colspan="2" style="height: 30px; vertical-align: middle;">
                    <asp:Label ID="Label1" runat="server" Style="font-weight: bold; font-size: 14px;
                        margin-left: 30px; font-family: 新宋体; vertical-align: bottom; text-align: center;" ><%# Eval("bigclass") %></asp:Label>
                    <hr style="border-right: gainsboro 1px dashed; border-top: gainsboro 1px dashed;
                        vertical-align: bottom; border-left: gainsboro 1px dashed; width: 98%; border-bottom: gainsboro 1px dashed;
                        height: 1px; text-align: center" />
                </td>
            </tr>
            <tr>
                <td style="width: 10%; margin-top: 30px; vertical-align: top; text-align: left;">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/img/12.jpg" Style="margin-top: 5px;
                        margin-left: 35px" /></td>
                <td style="width: 80%; margin-top: 5px; font-size: 12px; font-family: 新宋体;">
                    <asp:DataList ID="DataList1" runat="server" DataSourceID="datalist"
                        RepeatColumns="2" Style="margin-top: 5px; margin-left: 10px" Width="98%" DataKeyField="id">
                        <ItemTemplate>
                            <asp:Label ID="smallclassLabel" runat="server" Text='<%# Eval("smallclass") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:DataList>
<asp:AccessDataSource ID="datalist" runat="server" DataFile="~/App_Data/news.mdb"
                        SelectCommand="SELECT [id], [smallclass], [bigclassid] FROM [small] WHERE ([bigclassid] = ?)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="Label1"  Name="bigclassid" PropertyName="Text" Type="Decimal"  />
                        </SelectParameters>
                    </asp:AccessDataSource>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="height: 15px">
                </td>
            </tr>
        </table>
        </ItemTemplate>
        </asp:Repeater>
        <asp:AccessDataSource ID="AccessDataSource5" runat="server" DataFile="~/App_Data/news.mdb"
            SelectCommand="SELECT  [id], [bigclass] FROM [bigclass]"></asp:AccessDataSource>

想得到的效果:
只有本站会员才能查看附件,请 登录


现在是他只显示分类不显示标题 ,也就是 datalist 不能根据label1的值来显示数据,这个如何解决!  
设计的要求是能把所有分类和其他的内容都显示出来,并能动态的修改,或者有其他好的方法?
2 回复
#2
beniao2008-04-28 00:26
回复 1# 的帖子
不会用DataSource
1