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

Binding to a Data Source

This tutorial shows how to bind RadToolBar to an AccessDataSource:

  1. Locate the file "Chart.mdb" file that appears in the Live Demos/App_Data folder of your RadControls installation. Drag this file to the App_Data folder in the Solution Explorer for your project:

toolbar chartmdb

  1. Drag a RadToolBar component from the toolbox onto your Web page. The RadToolBar Smart Tag should appear automatically:

toolbar smarttag

  1. In the RadToolBar Smart Tag, use the Skin drop-down to change the skin for the RadToolBar to "Hay":

toolbar chooseskin

  1. Still in the Smart Tag, open the Choose Data Source drop-down and select New Data Source.

toolbar newdatasource

  1. The Data Source Configuration Wizard appears. In the Select a DataSource Type screen, specify an AccessDataSource and click OK.

Data Source Configuration Wizard

  1. In the Choose a Database screen, click the Browse button, and select the "Chart.mdb" file. Then choose Next to continue:

Configure Data Source

  1. In the Configure the Select Statement screen, choose Specify columns from a table or view. Select the "Subcategory" table from the Name drop down, and select the "Id", "Name", and "Category_id" fields:

Configure Data Source

  1. Click the WHERE button to add a where clause to your query. In the Add WHERE Clause screen, set the Column to "Category_Id", the Operator to "=", the Source to "None", and set the parameter value to "1":

Add Where Clause

  1. Click the Add button to add the WHERE clause, and then click OK.

  2. Back in the Configure The Select Statement page, click Next to accept the select statement.

  3. Click the Test Query button to see the data from the data source. Then choose Finish to exit the Wizard:

ToolBar Test Query

  1. In the Properties pane for the RadToolBar component:

  2. Set the DataTextField property to "Name".

  3. Set the DataValueField property to "Id".

toolbar datafieldproperties

  1. Run the application. Note that the tabs are labelled using the "Name" field of the data source:

Bound ToolBar

See Also

In this article