Share via


Configure Data Source Dialog Box - ObjectDataSource

The Configure Data Source - ObjectDataSource dialog box helps you to configure an object data source when you want to display data from a business object in an ASP.NET Web server control that supports data binding. The title of the dialog box changes according to the ID of the data source control.

An object data source represents a middle-tier business object with data retrieval and update capabilities. If your business object includes a method that returns a DataSet object, then Web server controls can display and edit the returned data on a Web page.

Security noteSecurity Note:

Always revalidate user input in the business layer of your application. Do not rely on the calling process to provide safe data. For more information, see the "General Guidelines" section in Securing Data Access.

Web server controls that support data binding include, but are not limited to, the following:

BulletedList

DetailsView

GridView

RadioButtonList

CheckBoxList

DropDownList

ListBox

Repeater

DataList

FormView

Menu

TreeView

To access this dialog box from an ASP.NET Web server control

  1. In Visual Web Developer, open an ASPX page.

  2. Switch to Design view.

  3. From the Toolbox, drag one of the controls from the previous list onto the page. For example, from the Standard group of the Toolbox, drag a GridView control onto the page.

  4. Right-click the control and click Show Smart Tag.

  5. In the tasks window that appears, from the Choose Data Source drop-down list, select <New data source…>.

    Note

    Some controls only allow you to click Choose Data Source, after which you select <New data source…> from the Select a data source drop-down list.

    The Data Source Configuration Wizard opens.

  6. Under Where will the application get data from, click Object.

  7. In the Specify an ID for the data source box, type a data source ID.

    The default ID is ObjectDataSource1.

  8. Click OK.

    An ObjectDataSource control is automatically created on your page, and the Configure Data Source - ObjectDataSource1 window opens.

To access this dialog box directly from an ObjectDataSource control

  1. In Visual Web Developer, open an ASPX page.

  2. Switch to Design view.

  3. From the Data group of the Toolbox, drag an ObjectDataSource control onto the page.

  4. In the tasks window, click Configure Data Source.

    The Configure Data Source - ObjectDataSource1 window opens.

    After you configure the ObjectDataSource control, you can bind it to any of the Web server controls in the list above by specifying the data source ID in the Choose Data Source drop-down list, or in the DataSourceID property of the Web server control.

For more information about data binding, see ASP.NET Data Access Overview, or the following task-oriented topics.

Tasks

Walkthrough: Data Binding to a Custom Business Object

Walkthrough: Data Binding Web Pages with a Visual Studio Data Component

Walkthrough: Displaying and Formatting Data with the DataList Web Server Control

How to: Bind to Data in a Templated Control in Visual Studio

How to: Bind to Data in a Templated Control

UI Elements

  • Choose your business object
    This element appears in the Choose a Business Object step of the wizard.

    Specifies the business object that can be used to retrieve or update data. The drop-down list will only be populated if there are business objects defined in either the Bin directory or the App_Code directory of the Web site. Your business object needs to include a method that returns a DataSet object in order to display data in a Web server control. For more information and a code example, see Walkthrough: Data Binding to a Custom Business Object.

See Also

Concepts

ASP.NET Data-Bound Web Server Controls Overview

Data Source Controls Overview

Securing Data Access

Creating an ObjectDataSource Control Source Object

Binding to Data Using a Data Source Control

Binding Data to the TreeView Web Server Control

Binding to Hierarchical Data

Data-Binding Expressions Overview

Reference

ObjectDataSource Web Server Control Overview

ObjectDataSource

Other Resources

ObjectDataSource Web Server Control (Visual Studio)