Strange exceptions using FindControl after implementing master pages
- by inderio
I have some simple repeater code given here:
<asp:Repeater ID="ResultsRepeater" runat="server" DataSourceID="ResultsDS">
<HeaderTemplate>
<table id="Results" class="data">
<tr id="Header" runat="server">
<th>Item</th>
</tr>
</table>
</HeaderTemplate>
</asp:Repeater>
I used to be able to then access the repeater to get said header, as such:
HtmlTableRow header = ResultsRepeater.Controls[0].Controls[0].FindControl("Header") as HtmlTableRow;
After implementing master pages, I noticed my calls to header.InnerText and .InnerHtml throw exceptions, specifically:
'header.InnerHtml' threw an exception of type 'System.NotSupportedException'
'header.InnerText' threw an exception of type 'System.NotSupportedException'
Can anyone share what's going on with me? I am of course assuming master pages caused this, since it's the only thing I've changed besides minor updates (that should not affect this in any way).