I have an object of the following type:
public class TriggerMessage
{
public List<string> Triggers_EN { get; set; }
public List<string> Triggers_FR { get; set; }
public string Message_EN { get; set; }
public string Message_FR { get; set; }
public int UID { get; set; }
}
Now, I also have a bunch of these objects in a List...
List<TriggerMessage> dataset = new List<TriggerMessage>(){.......};
Now I am also binding this list to a repeater:
<table style="width:100%;">
<asp:Repeater ID="lstTriggers" runat="server">
<HeaderTemplate>
<tr style="border-bottom:1px solid black;">
<th>English Triggers</th>
<th>French Triggers</th>
<th>English Message</th>
<th>French Message</th>
<th>Actions</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><div style="overflow-x:scroll; width:100%"><%#Eval("Triggers_EN").ToString() %></div></td>
<td><div style="overflow-x:scroll; width:100%"><%#Eval("Triggers_FR").ToString() %></div></td>
<td><div style="overflow-x:scroll; width:100%"><%#Eval("Message_EN") %></div></td>
<td><div style="overflow-x:scroll; width:100%"><%#Eval("Message_FR") %></div></td>
<td><a href="Modify.aspx?ID=<%#Eval("UID") %>">Modify</a> | <a href="Delete.aspx?ID=<%#Eval("UID") %>">Delete</a></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
So what's the problem? well, in my repeater, for English and French triggers, i get the System.Collections.Generic.List`1[System.String]
instead of the actual list of string... i thought to myself: build a "simple" version of your object that only has a string instead of a list... but then that's a lof of code for just displaying an HTML version of the list.
Is there a way, using nested repeaters, to display the list of strings as separate strings, instead of having to build a different object or using OnItemDataBound
event?
and it worked like a charm! thanks! Please post as the answer. – MaxOvrdrv Aug 23 '18 at 16:33