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

    EntityDataSource

    • El
    • uytuyt
    • uyuyyut

    This example demonstrates how to bind RadListBox to Entity Framework data.

    <telerik:RadListBox runat="server" ID="RadListBox1" Height="200px" Width="200px"
    	DataSourceID="EntityDataSource1" DataTextField="ContactName">
    </telerik:RadListBox>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
    	ConnectionString="name=NorthwindReadWriteEntities"
    	DefaultContainerName="NorthwindReadWriteEntities" 
    	EntitySetName="Customers" 
    	Select="it.[ContactName], it.[City], it.[ContactTitle]"
    	AutoPage="true" OrderBy="it.[ContactName]">
    </asp:EntityDataSource>
    

    You may also see how to utilize Telerik OpenAccess ORM as a data access layer for our AJAX controls by visiting the OpenAccess ORM live demos here.

    • DefaultCS.aspx
    <%@ Page Language="C#"  %>
     
    <%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html>
    <head runat="server">
        <title>Telerik ASP.NET Example</title>
    </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 size-thin">
            <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBox1" Height="200px" Width="300px"
                DataSourceID="EntityDataSource1" DataTextField="ContactName">
            </telerik:RadListBox>
            <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindReadWriteEntities"
                DefaultContainerName="NorthwindReadWriteEntities" EntitySetName="Customers" Select="it.[ContactName], it.[City], it.[ContactTitle]"
                AutoPage="true" OrderBy="it.[ContactName]">
            </asp:EntityDataSource>
        </div>
        </form>
    </body>
    </html>

    Support & Learning Resources

    Find Assistance