views:

83

answers:

1

Hi,

How can i get index of generic list from form page? For example;

aspx.cs

List<string> names = new List<string>();
names.Add("a");
names.Add("b");
names.Add("c");

repeaterNames.datasource = names;
repeaterNames.DataBind();

aspx

<form>
  <repeater>
   <itemtemplate>
    **<%# Eval(?)%>**
   </itemtemplate>
  </repeater>
</form>
+4  A: 

Use ItemIndex:

<ItemTemplate>
    <%# Container.ItemIndex %>
</ItemTemplate>
LukeH