I have an ASP page with the following repeater:
<asp:Repeater runat="server" ID="RegionRepeater"
DataSourceID="SqlDataSourceRegions" EnableViewState="true">
<ItemTemplate>
<tr>
<td valign="top">
<b><%#Eval("description")%></b>
<asp:HiddenField runat="server" ID="RegionID"
Value='<%#Eval("region_id")%>'/>
</td>
<td>
<asp:FileUpload ID="FileUpload" runat="server" Width="368px" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
(The repeater is inside a Wizard, inside a content pane).
The code behind is connected to the
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
event. There are two items on the screen (two rows inside the table). However, when the code tries to read those items, the Items collection is empty!
foreach(RepeaterItem region in RegionRepeater.Items)
{
// Never runs - the RegionRepeater.Items.Count = 0
FileUpload fileUpload = (FileUpload) region.FindControl("FileUpload");
String regionID = ((HiddenField)region.FindControl("RegionID")).Value;
...
Why is the collection empty, when there are controls drawn on the screen?
Thanks a lot for any help; this is starting to drive me nuts.
(BTW: I tried adding/removing the EnableViewState="true" tag)