DataList -
DataList
Can you make the contents have a href links?
For example I am using DataList for Menu Item in ascx files to populate it dynamically using DataSet that got the Menu item from database.
I got the code working for DataList without a href links but I want the a href link to be dynamic too.
My code that works:
<asp:datalist id="dlMenu" runat="server">
<ItemTemplate>
<TD align="left" class="SectionMenu" align="left" vAlign="top">
<asp:Label id=lblProductID runat="server" Width="100px" Text='<%# DataBinder.Eval(Container,"DataItem.MenuName") %>' >
</asp:Label>
</TD>
</ItemTemplate>
</asp:datalist></tr>
When I add the a href to the code it doesn't work:
<asp:datalist id="dlMenu" runat="server">
<ItemTemplate>
<TD align="left" class="SectionMenu" align="left" vAlign="top">
<asp:Label id=lblProductID runat="server" Width="100px" Text='<a href="http://www.somesite.com<%# DataBinder.Eval(Container,"DataItem.MenuLink") %>"><%# DataBinder.Eval(Container,"DataItem.MenuName") %>'</a>
</asp:Label>
</TD>
</ItemTemplate>
</asp:datalist></tr>
Right now it only displays the 10 menu item
but I want these menu items to have their corresponding links so I can load up the menu items dynamically.
Remember links:
<a href="http://www.somesite.com/default.aspx">Home</a>
So why doesn't this work?
|