You can use a wide variety of data-sources for grid structure generation (the only requirement is that these custom objects implement the ITypedList/IEnumarable/ICustomTypeDescriptor interfaces). The code below demonstrates how to use ArrayList object for Telerik RadGrid structure generation:
| ASPX/ASCX |
Copy Code |
|
<rad:RadGrid id="RadGrid1" runat="server"> <MasterTableView AutoGenerateColumns="True"> </MasterTableView> </rad:RadGrid> |
And in the code-behind:
| C# |
Copy Code |
|
protected void RadGrid1_NeedDataSource(object source, Telerik.WebControls.GridNeedDataSourceEventArgs e) { ArrayList list = new ArrayList(); list.Add("string1"); list.Add("string2"); list.Add("string3"); RadGrid1.DataSource = list; } |
| VB.NET |
Copy Code |
|
Private Sub RadGrid1_NeedDataSource(ByVal [source] As Object, ByVal e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource Dim list As New ArrayList list.Add("string1") list.Add("string2") list.Add("string3") RadGrid1.DataSource = list End Sub |