Why is my Repeater null in code behind?
Posted
by Rob Stevenson-Leggett
on Stack Overflow
See other posts from Stack Overflow
or by Rob Stevenson-Leggett
Published on 2010-06-10T00:47:20Z
Indexed on
2010/06/10
0:52 UTC
Read the original article
Hit count: 257
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?
© Stack Overflow or respective owner