<asp:Repeater runat='server' DataSource=’<%# GetControls() %>’ ID='Repeater1'>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
-
<%# DataBinder.Eval(Container.DataItem, 'Name') %>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
VB.NET
Protected Function GetControls() As ArrayList
Dim arrList As New ArrayList()
Dim t As Type
For Each t In GetType(Page).Assembly.GetTypes()
If t.Namespace = 'System.Web.UI.WebControls' And GetType(Control).IsAssignableFrom(t) Then
arrList.Add(t)
End If
Next
Return arrList
End Function ’GetControls
’In Page_Load
DataBind()
C#
protected ArrayList GetControls()
{
ArrayList arrList = new ArrayList();
foreach (Type t in typeof(Page ).Assembly.GetTypes())
{
if (t.Namespace == 'System.Web.UI.WebControls' && typeof(Control).IsAssignableFrom(t))
arrList.Add(t);
}
return arrList;
}
//In Page_Load
DataBind();
Share with