<cc1:SiteSearchInputView ID="ssInputView" ControllerID="ssController" runat="server">
<ItemTemplate>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><label>Search <asp:Literal ID="litSite" runat="server" /></label></td>
<td><asp:TextBox ID="tbSearchText" runat="server" /></td>
<td><asp:Button ID="btnSearch" CssClass="searchBTN" runat="server" /></td>
</tr>
</table>
</ItemTemplate>
</cc1:SiteSearchInputView>
I need to be able to set the text for the litSite literal at runtime (it changes based on another method). When I try using
Literal l = (Literal) ssInputView.FindControl("litSite");
I get an "Object not set to instance of an object" error.
How do you set the value of a child control inside a templated user control when you don't have access to the source of the templated control?