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


This example shows how a RadHtmlChart can be bound to a EntityDataSource. The major properties are:

  • DataSourceID in the main tag sets the declarative data source for the entire chart. The DataSource property can be used for a programmatic data source if you create the connection in the code-behind.
  • DataFieldY for the series to point it to the desired column of the data source.
  • DataLabelsField for the x-axis labels to populate the items for the axis (it can also be applied to the y-axis).
  • DefaultVB.aspx
<%@ Page Language="vb"  %>

<%@ Register Assembly="System.Web.Entity, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>

    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindReadOnlyEntities"
        DefaultContainerName="NorthwindReadOnlyEntities" CommandText="select p.ProductName, p.UnitsInStock from NorthwindReadOnlyEntities.Products as p where p.CategoryID = 1">
    <div class="demo-container size-wide">
        <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="800px" Height="500px"
                    <telerik:BarSeries DataFieldY="UnitsInStock" Name="Drinks">
                        <TooltipsAppearance Visible="false"></TooltipsAppearance>
                <XAxis DataLabelsField="ProductName">
                    <MinorGridLines Visible="false"></MinorGridLines>
                    <MajorGridLines Visible="false"></MajorGridLines>
                    <TitleAppearance Text="Units"></TitleAppearance>
                    <MinorGridLines Visible="false"></MinorGridLines>
                <Appearance Visible="false"></Appearance>
            <ChartTitle Text="Units In Stock">

Support & Learning Resources

Find Assistance