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

Various data sources

Binding RadListView to:
Array list New York :: Madrid :: Rome :: Tokio :: Moscow
Generic list
Name: Boston Crab Meat
Price: $9.00
Date: 9/13/2008
Available: Yes


Name: Singaporean Hokkien Fried Mee
Price: $45.60
Date: 2/22/2008
Available: Yes


Name: Gula Malacca
Price: $32.00
Date: 1/2/2009
Available: Yes


Name: Boston Crab Meat
Price: $9.00
Date: 9/13/2008
Available: Yes


Name: Spegesild
Price: $19.00
Date: 5/12/2008
Available: Yes


Name: Côte de Blaye
Price: $23.25
Date: 5/10/2007
Available: No


Name: Chocolade
Price: $18.40
Date: 8/26/2008
Available: Yes


Name: Singaporean Hokkien Fried Mee
Price: $45.60
Date: 2/22/2008
Available: Yes


Name: Valkoinen suklaa
Price: $14.00
Date: 7/16/2007
Available: No


DataReader
Speedy Express (503) 555-9831
United Package (503) 555-3199
Federal Shipping (503) 555-9931
You can use a wide variety of data-sources for RadListView structure generation (the only requirement is that these custom objects implement the ITypedList/IEnumarable/ICustomTypeDescriptor interfaces). The code under the ASPX/C#/VB.NET tabs demonstrates how to:
  • use ArrayList object for Telerik RadListView structure generation
  • bind the listview to list of custom objects (Generic list)
  • bind RadListView to a DataReader
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
    • DefaultVB.aspx.vb
    • MyBusinessObjects.vb
  • styles.css
<%@ Page Language="vb" AutoEventWireup="false" Inherits="Telerik.ListViewExamplesVBNET.DataBinding.VariousDataSources.DefaultVB"CodeFile="DefaultVB.aspx.vb"  %>

<%@ Import Namespace="Telerik.Web.Examples.Grid" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecoratedControls="All" ControlsToSkip="H4H5H6" />
    <div class="demo-container">
        <table id="Table2" class="mainTable">
            <tr>
                <td class="demoTitle">Binding RadListView to:
                </td>
            </tr>
            <tr>
                <td>
                    <telerik:RadListView ID="RadListView1" runat="server" RenderMode="Lightweight" ItemPlaceholderID="CityItemsHolder"
                        OnNeedDataSource="RadListView1_NeedDataSource">
                        <LayoutTemplate>
                            <fieldset class="fieldset">
                                <legend>Array list</legend>
                                <asp:Panel ID="CityItemsHolder" runat="server">
                                </asp:Panel>
                            </fieldset>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <span>
                                <%# Container.DataItem %></span>
                        </ItemTemplate>
                        <ItemSeparatorTemplate>
                            <span class="itemSeparator">::</span>
                        </ItemSeparatorTemplate>
                    </telerik:RadListView>
                </td>
            </tr>
            <tr>
                <td>
                    <telerik:RadListView ID="RadListView2" runat="server" RenderMode="Lightweight" ItemPlaceholderID="ProductsHolder"
                        OnNeedDataSource="RadListView2_NeedDataSource">
                        <LayoutTemplate>
                            <fieldset class="productsFieldset">
                                <legend>Generic list</legend>
                                <asp:Panel ID="ProductsHolder" runat="server">
                                </asp:Panel>
                            </fieldset>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <div class="productsWrapper">
                                <table class="productsTable">
                                    <tr>
                                        <td class="cellLabel">Name:
                                        </td>
                                        <td class="cellInfo">
                                            <%# CType(Container.DataItem, MyBusinessObject).Name%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Price:
                                        </td>
                                        <td class="cellInfo">
                                            <%# String.Format("{0:C}", CType(Container.DataItem, MyBusinessObject).UnitPrice)%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Date:
                                        </td>
                                        <td class="cellInfo">
                                            <%# String.Format("{0:d}", CType(Container.DataItem, MyBusinessObject).Date)%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Available:
                                        </td>
                                        <td class="cellInfo">
                                            <%#IIf(DataBinder.Eval(Container.DataItem, "Discontinued") = False, "Yes", "No")%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <hr />
                                        </td>
                                        <td>
                                            <hr />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </ItemTemplate>
                    </telerik:RadListView>
                </td>
            </tr>
            <tr>
                <td>
                    <telerik:RadListView ID="RadListView3" runat="server" RenderMode="Lightweight" ItemPlaceholderID="ShippersHolder"
                        OnNeedDataSource="RadListView3_NeedDataSource" OnDataBound="RadListView3_DataBound">
                        <LayoutTemplate>
                            <fieldset class="fieldset">
                                <legend>DataReader</legend>
                                <asp:Panel ID="ShippersHolder" runat="server">
                                </asp:Panel>
                            </fieldset>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <table class="shipperTable">
                                <colgroup>
                                    <col title="Shipper name" />
                                    <col title="Phone" />
                                </colgroup>
                                <tr>
                                    <td class="shipperCell">
                                        <%# Eval("CompanyName") %>
                                    </td>
                                    <td class="shipperCell">
                                        <%# Eval("Phone") %>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </telerik:RadListView>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance