# Binding to ObjectDataSource at Run-Time

> caution **RadChart** has been deprecated since Q3 2014 and is marked as obsolete as of the 2026 Q2 SP1 (v2026.2.708) release. This is the last release that includes the RadChart component — its source code will be removed from the assembly in the next release. We strongly recommend using [RadHtmlChart](https://www.telerik.com/products/aspnet-ajax/html-chart.aspx), Telerik's modern client-side charting component.
> To transition from RadChart to RadHtmlChart, refer to the following migration articles:
>
> * [Migrating Series](https://www.telerik.com/products/aspnet-ajax/documentation/controls/htmlchart/changes-and-backwards-compatibility/migrating-from-radchart-to-radhtmlchart/migrate-series-configuration)
> * [Migrating Axes](https://www.telerik.com/products/aspnet-ajax/documentation/controls/htmlchart/changes-and-backwards-compatibility/migrating-from-radchart-to-radhtmlchart/migrate-axes-configuration)
> * [Migrating Date Axes](https://www.telerik.com/products/aspnet-ajax/documentation/controls/htmlchart/changes-and-backwards-compatibility/migrating-from-radchart-to-radhtmlchart/migrate-date-axis-configuration)
> * [Migrating Databinding](https://www.telerik.com/products/aspnet-ajax/documentation/controls/htmlchart/changes-and-backwards-compatibility/migrating-from-radchart-to-radhtmlchart/migrate-data-binding-configuration)
> * [Features parity](https://www.telerik.com/products/aspnet-ajax/documentation/controls/htmlchart/changes-and-backwards-compatibility/migrating-from-radchart-to-radhtmlchart/migrate-functionalities---features-and-series-types-parity)
>
> Explore the [RadHtmlChart documentation](https://www.telerik.com/products/aspnet-ajax/documentation/controls/htmlchart/overview) and online demos to determine how it fits your development needs.

Once a business object with appropriate attributes has been created you can bind to it in code at run-time. The steps are:

* Set the [ObjectDataSource](https://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx)[TypeName](https://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.typename.aspx) property to name of the object class, in this example "RadChartBinding.ProductsBO" (Be sure to qualify the class name with the namespace).

* Set the [SelectMethod](https://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.selectmethod.aspx) to the method marked by the [DataObjectMethodAttribute](https://msdn2.microsoft.com/en-us/library/system.componentmodel.dataobjectmethodattribute.aspx).

The code below demonstrates binding to an [ObjectDataSource](https://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx) that consumes an example object defined in the topic "[Creating an Object that can be consumed by ObjectDataSource](https://www.telerik.com/products/aspnet-ajax/documentation/controls/chart/building-radcharts/creating-an-object-that-can-be-consumed-by-objectdatasource)".

> caption Example: Bind RadChart to an ObjectDataSource at run time

```C#
// Create and configure the data source used by the chart.
ObjectDataSource ods = new ObjectDataSource();
ods.SelectMethod = "GetProducts";
ods.TypeName = "RadChartBinding.ProductsBO";
RadChart1.DataSource = ods.Select();
RadChart1.Series[0].DataYColumn = "QuantityInStock";
RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name";
RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);

RadChart1.DataBind();			
```

```VB
	' Create and configure the data source used by the chart.
	Dim ods As New ObjectDataSource()
	ods.SelectMethod = "GetProducts"
	ods.TypeName = "RadChartBinding.ProductsBO"
	RadChart1.DataSource = ods.[Select]()
	RadChart1.Series(0).DataYColumn = "QuantityInStock"
	RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name"
	RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = New System.Drawing.Font("Arial", 8)
	RadChart1.DataBind()				
```

## See Also

* [Data Binding RadChart to an ObjectDataSource](https://www.telerik.com/products/aspnet-ajax/documentation/controls/chart/building-radcharts/data-binding-radchart-to-an-objectdatasource)

* [Creating an Object that can be Consumed by ObjectDataSource](https://www.telerik.com/products/aspnet-ajax/documentation/controls/chart/building-radcharts/creating-an-object-that-can-be-consumed-by-objectdatasource)

* [Binding to ObjectDataSource at Run-Time](https://www.telerik.com/products/aspnet-ajax/documentation/controls/chart/building-radcharts/binding-to-objectdatasource-at-run-time)

* [Data Binding RadChart to ObjectDataSource at Design-Time](https://www.telerik.com/products/aspnet-ajax/documentation/controls/chart/building-radcharts/data-binding-radchart-to-objectdatasource-at-design-time)
