我是Repeater
内,我想看看哪种对象的重复OnItemDataBound
,但是这样做:如何从DataSource获取对象的类型?
public void RepeaterListato_OnItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
Response.Write(repeaterListato.DataSource.GetType());
}
它返回整个集合的类型:
System.Collections.Generic.List`1[BrLayer.Pagina]
不BrLayer.Pagina
。有没有办法?
[如何从泛型类或方法的成员获取T的类型?](https://stackoverflow.com/questions/557340/how-to-get-the-type-of- t-from-a-generic-class-or-method) – derape
@derape,Repeater不一定绑定到泛型集合,所以你的提示是不合适的。 – Joe
为什么downvotes?特别是没有有用的评论来解释如何改善问题。 – Joe