我是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