New to Telerik UI for ASP.NET AJAX? Start a 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:
C#
<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>
Code-behind:
C#
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;
}