日期:2014-05-18  浏览次数:20763 次

datalist分别加连接
我用datalist读取了数据库中一个城市列表,现在需要在每个城市加一个连接如:北京     上海...大连,如果点北京就跳到北京相应页面去.点上海跳上海....

------解决方案--------------------
<a href= "http://www.1.com/a.asox?id= " <%# DataBinder.Eval(Container.Item, "数据库字段名字 ") %>
------解决方案--------------------
列子可以这样绑定:
<asp:DataList ID= "DataList1 " runat= "server ">
<ItemTemplate>
<a href= ' <%#Eval( "ProductId ", "ProductsView.aspx?ProductId={0} ") %> ' class= "linkTitle "> <asp:Label ID= "lblProductName " runat= "server " Text= ' <%# Bind( "ProductName ") %> '> </asp:Label> </a>
</ItemTemplate>
</asp:DataList>