New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Binding to an ArrayList

You can use a wide variety of custom objects as data sources for RadGrid. The only requirement is that the custom objects must implement the ITypedList, IEnumarable, or ICustomTypeDescriptor interface. The example below demonstrates how to use one of these (ArrayList) to provide the structure of a RadGrid control:

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0"
    GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource1" PageSize="10">
    <MasterTableView AutoGenerateColumns="true">
    </MasterTableView>
</telerik:RadGrid>
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0"
    GridLines="None" PageSize="10">
    <MasterTableView AutoGenerateColumns="true">
    </MasterTableView>
</telerik:RadGrid>

Code-behind:

protected void RadGrid1_NeedDataSource1(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    ArrayList list = new ArrayList();
    list.Add("string1");
    list.Add("string2");
    list.Add("string3");
    RadGrid1.DataSource = list;
}
Private Sub RadGrid1_NeedDataSource(ByVal [source] As Object, ByVal e As GridNeedDataSourceEventArgs)
    Dim list As New ArrayList
    list.Add("string1")
    list.Add("string2")
    list.Add("string3")
    RadGrid1.DataSource = list
End Sub
In this article