I have a number of pages
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="MyPage.aspx.cs" Inherits="MyPage " MasterPageFile="~/Site.master" %>
<asp:Content ContentPlaceHolderID="commonForm" runat="server">
<asp:Table runat="server">
<asp:TableRow>
<asp:TableCell ID="cellControl" />
</asp:TableRow>
</asp:Table>
</asp:Content>
public partial class MyPage : MySuperPage { }
and a super class for them:
public abstract class MySuperPage : Page
{
public MySuperPage()
{
this.Load += new EventHandler(PageLoad);
}
// my own method
protected void PageLoad(object sender, EventArgs e)
{
var c = this.FindControl("cellControl"); // null!
}
// auto event handling
protected void Page_Load(object sender, EventArgs e)
{
var c = this.FindControl("cellControl"); // null!
}
}
Why neither method can't find a control?