I'm trying to populate a dropdown list inside a repeater, but I'm not being very successful. I'm probably using the wrong EventArgs e.
Here's my aspx code:
<asp:Repeater runat="server" id="criteriaScore">
<HeaderTemplate>
<ul>
<li class="header"><span class="item">Kriterie</span><span class="value">Poeng</span><span class="description">Beskrivelse</span></li>
</HeaderTemplate>
<ItemTemplate>
<li>
<span class="item"> <%# Eval("criteria") %>:</span>
<asp:DropDownList id="ddlRating" runat="server" autopostback="true" enableviewstate="false"></asp:DropDownList>
<span class="value score<%# Eval("lvl") %>" title="<%# Eval("description") %>"> </span>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
And the code behind:
protected void criteriaScore_ItemDataBound(object sender, DataListCommandEventArgs e)
{
DropDownList ddl = (DropDownList)e.Item.FindControl("ddlRating");
for(int i=1; i > 5; i++)
{
ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
}
Can someone please guide me down the right path? :)