在一个页面中有两个datalist,datalist1,datalist2,datalist1是超链接的形式,datalist2显示相应的字段。急 5
怎么样使得页面加载时datalist2就显示datalist1的第一个超链接的相应字段,我的代码如下:<asp:DataListID="DataList1"runat="...
怎么样使得页面加载时datalist2就显示datalist1的第一个超链接的相应字段,我的代码如下:
<asp:DataList ID="DataList1" runat="server" BorderColor="ActiveBorder" BorderWidth="1px" GridLines="Both" Width="216px" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" >
<ItemStyle CssClass="nav" />
<ItemTemplate>
<a href="product.aspx?zhonglei=<%#Eval("zhonglei")%>"><asp:Label ID="zhongleiLabel" runat="server" Text='<%# Eval("zhonglei") %>'></asp:Label></a>
<br />
</ItemTemplate>
</asp:DataList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/login.mdb"
SelectCommand="SELECT distinct zhonglei FROM [spfwq]"></asp:AccessDataSource>
<asp:DataList ID="DataList2" runat="server" DataKeyField="id" DataSourceID="AccessDataSource2" RepeatColumns="3" >
<ItemTemplate>
<a href="xiangxixinxi.aspx?id=<%#Eval("id")%>"><asp:Image ID ="image2" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem,"picture") %>' Width="183" Height="100"/>
</a><br />
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>'></asp:Label><br />
<br />
</ItemTemplate>
</asp:DataList><asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/login.mdb"
SelectCommand="SELECT * FROM [spfwq] WHERE ([zhonglei] = ?)">
<SelectParameters>
<asp:QueryStringParameter Name="zhonglei" QueryStringField="zhonglei" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
我没有积分,恳请 大家帮忙!!谢谢 展开
<asp:DataList ID="DataList1" runat="server" BorderColor="ActiveBorder" BorderWidth="1px" GridLines="Both" Width="216px" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" >
<ItemStyle CssClass="nav" />
<ItemTemplate>
<a href="product.aspx?zhonglei=<%#Eval("zhonglei")%>"><asp:Label ID="zhongleiLabel" runat="server" Text='<%# Eval("zhonglei") %>'></asp:Label></a>
<br />
</ItemTemplate>
</asp:DataList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/login.mdb"
SelectCommand="SELECT distinct zhonglei FROM [spfwq]"></asp:AccessDataSource>
<asp:DataList ID="DataList2" runat="server" DataKeyField="id" DataSourceID="AccessDataSource2" RepeatColumns="3" >
<ItemTemplate>
<a href="xiangxixinxi.aspx?id=<%#Eval("id")%>"><asp:Image ID ="image2" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem,"picture") %>' Width="183" Height="100"/>
</a><br />
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>'></asp:Label><br />
<br />
</ItemTemplate>
</asp:DataList><asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/login.mdb"
SelectCommand="SELECT * FROM [spfwq] WHERE ([zhonglei] = ?)">
<SelectParameters>
<asp:QueryStringParameter Name="zhonglei" QueryStringField="zhonglei" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
我没有积分,恳请 大家帮忙!!谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询