Binding to a Data Source
This tutorial shows how to bind RadToolBar to an AccessDataSource:
-
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:
-
Drag a RadToolBar component from the toolbox onto your Web page. The RadToolBar Smart Tag should appear automatically:
-
In the RadToolBar Smart Tag, use the Skin drop-down to change the skin for the RadToolBar to "Hay":
-
Still in the Smart Tag, open the Choose Data Source drop-down and select New Data Source.
-
The Data Source Configuration Wizard appears. In the Select a DataSource Type screen, specify an AccessDataSource and click OK.
-
In the Choose a Database screen, click the Browse button, and select the "Chart.mdb" file. Then choose Next to continue:
-
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:
-
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":
-
Click the Add button to add the WHERE clause, and then click OK.
-
Back in the Configure The Select Statement page, click Next to accept the select statement.
-
Click the Test Query button to see the data from the data source. Then choose Finish to exit the Wizard:
-
In the Properties pane for the RadToolBar component:
-
Set the DataTextField property to "Name".
-
Set the DataValueField property to "Id".
-
Run the application. Note that the tabs are labelled using the "Name" field of the data source: