Why is my Repeater null in code behind?
- by Rob Stevenson-Leggett
I'm just starting a new project and I am getting some really weird stuff happening.
ASP.NET 3.5, VS2008.
I've tried rebuild, close VS, delete everything and get from svn again but I cannot understand why the repeater in the following is null on page_load.
I know this is going to be a headslapping moment. Help me out?
Markup:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GalleryControl.ascx.cs" Inherits="Site.UserControls.GalleryControl" %>
<asp:Repeater ID="rptGalleries" runat="server">
<HeaderTemplate><ul></HeaderTemplate>
<ItemTemplate>
<li>wqe</li>
</ItemTemplate>
<FooterTemplate></ul></FooterTemplate>
</asp:Repeater>
Code behind
public partial class GalleryControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
rptGalleries.DataSource = new[] {1, 2, 3, 4, 5};
rptGalleries.DataBind();
}
}
Why is my repeater null? What the F is going on?