I need to place a user control into the template of a repeater control and reference data items from the repeater's datasource.
I tried (ignore the second cast which is specific to the CMS platform I'm using):
<%# ((EPiServer.Core.PageData)((RepeaterItem)Container.Parent.NamingContainer).DataItem)["PageName"]%>
But that throws back the following error: Unable to cast object of type 'ASP.usercontrols_searchcontrols_searchresult_ascx' to type 'System.Web.UI.WebControls.RepeaterItem'
Searchresult_ascx is another user control that contains the actual repeater.