<asp:Repeater ID="Repeater_RatingQuestions_Individuals" runat="server">
<ItemTemplate>
<asp:Label CssClass="bold center" ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Question")%>' />
<asp:Repeater ID="Repeater_RatingAnswers_Individuals" runat="server" DataSource='<%# DataBinder.Eval(Container.DataItem, "Answers") %>'>
<HeaderTemplate>
<table cellpadding="5" cellspacing="8">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"UserID")%>' />
</td>
<td>
<asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Answer") %>' />
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Value") %>' />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
This is my repeater. I have 2 classes:
public class cQuestion
{
public string Question { get; set; }
public List<cAnswer> Answers { get; set; }
}
public class cAnswer
{
public string Answer { get ; set; }
public uint Value { get; set; }
public string UserID { get; set; }
}
Without having to creating some other generic list of an object, would it be possible to display for the first record the UserID, in the nested Repeater, but for the rest of them not show the UserID? If it’s not possible then fine I’ll just go with my alternate solutions. I just wanted to know if this is possible without having to add new properties or new classes. Thanks in advance.
Sorry if this is off a little (I haven’t used Repeaters in a very long time). Have you tried calling a Code Behind function from within the repeater?
Then in your code behind