I am using databinding to iterate through a recordset returned from the database, and one of those recordsets is a comma separated list of items - I'm trying to use a second repeater to display each of those items as a hyperlink. So far this is the code that I have:
<asp:Repeater ID="myRepeater" runat="server" DataSource='<%# DataBinder.Eval(Container.DataItem, "SomeList").ToString().Trim(',') %>'>
<ItemTemplate>
<a href='http://somesite/downloadattachment.aspx?itemid=<%# Container.ItemIndex %>'><%# Container.DataItem %></a>
</ItemTemplate>
</asp:Repeater>
The trouble is that so far there are 3 reasons why this doesnt work:
- I get a
server tag is not well formed
error unless I remove therunat="server"
- why is this? (And why does it work without therunat="server"
?) Container.DataItem
Evaluates to an instance ofSystem.Data.DataRowView
- how do I get the current piece of the string that I split?- More importantly, this only seems to print out 1
Container.DataItem
, even when I know there is a comma in the string I've given it - any ideas?