Here is the snapshot of repeater code. I have problems with geting all the values. In result my "repeater" prints only first element in collection.
<asp:Repeater ID="repeatAdministrators" OnItemDataBound="repeatAdministrators_ItemDataBound" runat="server">
<HeaderTemplate>
<tr>
<td class="formLabel">
Administrators:
</td>
<td class="formInputText">
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="txtAdministrators" runat="server" MaxLength="50" Enabled="False"></asp:TextBox><br />
</ItemTemplate>
<FooterTemplate>
</td> </tr>
<tr>
</FooterTemplate>
</asp:Repeater>
And here the code behind where I want to change read index in collection. AdminsEnumerator.MoveNext();
is not working as I expected. Adding something like int t; i++; StringCollection[i]
is annoying. Are there easier solutions?
protected void repeatAdministrators_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
TextBox txtAdministrators = e.Item.FindControl("txtAdministrators") as TextBox;
StringEnumerator AdminsEnumerator = Computer.Administrators.GetEnumerator();
AdminsEnumerator.MoveNext();
txtAdministrators.Text = AdminsEnumerator.Current;
}
}