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


This example shows how a RadHtmlChart can be bound to an ObjectDataSource. The ObjectDataSource uses a custom class Vehicle, which is declared in the App_Code directory of the website application. The major chart 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
  • Vehicle.vb
<%@ Page Language="vb"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ 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" />
    <div class="demo-container size-wide">
        <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Height="400px" Width="800px"
                    <telerik:ColumnSeries DataFieldY="AverageRating">
                        <TooltipsAppearance Color="White" />
                <XAxis DataLabelsField="VehicleName">
                    <TitleAppearance Text="Vehicle Name">
                        <TextStyle Margin="20" />
                    <MajorGridLines Visible="false" />
                    <MinorGridLines Visible="false" />
                    <TitleAppearance Text="Average Rating">
                        <TextStyle Margin="20" />
                    <MinorGridLines Visible="false" />
            <ChartTitle Text="Vehicles Average Rating">
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="Vehicle" SelectMethod="GetVehicleRatings"></asp:ObjectDataSource>

Support & Learning Resources

Find Assistance