Repeater 内の ID の組み込みサポートを使用する方がよいと思います。ID を割り当てて、データがバインドされた後に適切なコントロールを簡単に見つけられるようにすることが目標である場合は、次のようなことを試してください。
<asp:Repeater ID="Repeater1" runat="server>
<ItemTemplate>
<asp:Label ID="QuestionID" Visible="False" Runat="server"><%#DataBinder.Eval(Container.DataItem, "FieldContent")%></asp:Label>
<asp:DropDownList ID="MyDropDownList" Runat="server"></asp:DropDownList>
</ItemTemplate>
</asp:Repeater>
次に、コードで、探しているラベルが見つかるまで、Repeater 内の項目をループできます。
foreach (RepeaterItem curItem in Repeater1.Items)
{
// Due to the way a Repeater works, these two controls are linked together. The questionID
// label that is found is in the same RepeaterItem as the DropDownList (and any other controls
// you might find using curRow.FindControl)
var questionID = curRow.FindControl("QuestionID") as Label;
var myDropDownList = curRow.FindControl("MyDropDownList") as DropDownList;
}
Repeater は、基本的に RepeaterItems のコレクションで構成されます。RepeaterItems は、ItemTemplate タグを使用して指定されます。各 RepeaterItem には、Repeater の性質上、相互に関連付けられた独自のコントロール セットがあります。
データベースから Repeater データを取得しているとします。各 Repeater アイテムは、クエリ結果の個々の行からのデータを表します。したがって、QuestionID をラベルに割り当て、QuestionName を DropDownList に割り当てると、ラベルの ID がドロップダウンの名前と一致します。