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

Migration from ASP.NET ListView

RadListView

  • Tofu
  • 40 - 100 g pkgs.
  • $23.25
  • 35
  • False
  • Genen Shouyu
  • 24 - 250 ml bottles
  • $15.50
  • 39
  • False
  • Alice Mutton
  • 20 - 1 kg tins
  • $39.00
  • 0
  • True

ASP.NET ListView

  • Tofu
  • 40 - 100 g pkgs.
  • $23.25
  • 35
  • False
  • Genen Shouyu
  • 24 - 250 ml bottles
  • $15.50
  • 39
  • False
  • Alice Mutton
  • 20 - 1 kg tins
  • $39.00
  • 0
  • True

The declarative syntax of Telerik RadListView is quite similar to that of the Microsoft ListView control, which makes the migration a pretty straightforward task. Compare the source codes in the ASPX tab.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="c#" Inherits="Telerik.ListViewExamplesCSharp.Migration.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ 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" />
    <div class="demo-container">
        <!-- content start -->
        <table>
            <tr>
                <td class="offset">
                    <h3>
                        RadListView</h3> 
                    <telerik:RadListView ID="RadListView1" DataSourceID="SqlDataSource1" runat="server" RenderMode="Lightweight" 
                        ItemPlaceholderID="ProductItemContainer">
                        <LayoutTemplate>
                            <fieldset id="ProductItemContainer" runat="server">
                            </fieldset>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <ul>
                                <li>
                                    <label>
                                        Product name:</label>
                                    <%#Eval("ProductName")%>
                                </li>
                                <li>
                                    <label>
                                        Quantity per unit:</label>
                                    <%#Eval("QuantityPerUnit")%>
                                </li>
                                <li>
                                    <label>
                                        Unit price:</label>
                                    <%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:C}")%>
                                </li>
                                <li>
                                    <label>
                                        Units in stock:</label>
                                    <%#Eval("UnitsInStock")%>
                                </li>
                                <li>
                                    <label>
                                        Discontinued:</label>
                                    <%#Eval("Discontinued")%>
                                </li>
                            </ul>
                        </ItemTemplate>
                    </telerik:RadListView>
                </td>
                <td>
                    <h3>
                        ASP.NET ListView</h3>
                    <asp:ListView ID="ListView1" DataSourceID="SqlDataSource1" runat="server" ItemPlaceholderID="ProductItemContainer">
                        <LayoutTemplate>
                            <fieldset id="ProductItemContainer" runat="server">
                            </fieldset>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <ul>
                                <li>
                                    <label>
                                        Product name:</label>
                                    <%#Eval("ProductName")%>
                                </li>
                                <li>
                                    <label>
                                        Quantity per unit:</label>
                                    <%#Eval("QuantityPerUnit")%>
                                </li>
                                <li>
                                    <label>
                                        Unit price:</label>
                                    <%# DataBinder.Eval(Container.DataItem, "UnitPrice", "{0:C}")%>
                                </li>
                                <li>
                                    <label>
                                        Units in stock:</label>
                                    <%#Eval("UnitsInStock")%>
                                </li>
                                <li>
                                    <label>
                                        Discontinued:</label>
                                    <%#Eval("Discontinued")%>
                                </li>
                            </ul>
                        </ItemTemplate>
                    </asp:ListView>
                </td>
            </tr>
        </table>
        <br/>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 3 ProductID, ProductName, QuantityPerUnit, UnitPrice, UnitsInStock, Discontinued FROM Products">
        </asp:SqlDataSource>
        <!-- content end -->
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance