我的代码从XML文档中获取搜索类型,抓取第一个,为该搜索类型创建用户控件的实例,然后填充它。我已将它的实例作为UserControl转换为试图让它显示但它不会。如何在asp.net页面中显示用户控件的填充实例?
void Display(List<DataResult> entityList)
{
List<SearchObjectType> searchTypes = SearchXMLParser.GetSearchTypes();
SearchObjectType sot = searchTypes[0];
ICard soType = sot.InstantiateSearchObject();
foreach (DataResult entityObject in entityList)
{
soType.Populate(entityObject);
PlaceHolder1.Controls.Add(((UserControl)soType)); /* this is the problem*/