There are a couple things here. First, because of the nature of our skinning engine (basically Masterpages before Masterpages existed), the controls do not yet exist in the page life cycle where you are trying to access them. A better place to do this would be in App_Code/SkinBase.cs...just add an OnInit override to the file and do your logic there
Code:
protected override void OnInit(EventArgs e)
{
Literal lTest = (Literal)this.FindControl("litTest");
lTest.Text = "Text that I'm using to replace in template.ascx from SkinBase";
base.OnInit(e);
}
Then my template.ascx file
Code:
<asp:Literal ID="litTest" runat="server">litTest</asp:Literal>
litTest would be replaced with Text that I'm using to replace in template.ascx from SkinBase.
The other thing that you'll need to remember is that if you plan on accessing controls in the template from a code-behind or class, that the control will need to have the runat attribute added...this will work
Code:
<asp:Literal ID="litTest" runat="server">litTest</asp:Literal>
this will not
Code:
<asp:Literal ID="litTest">litTest</asp:Literal>