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.

System_CAPS_security Security 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 in ASP.NET.

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 Options, or the following task-oriented topics.

Tasks

Walkthrough: Using the ObjectDataSource with an XML File

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: Using the ObjectDataSource with an XML File.

See Also

ObjectDataSource
Data-Bound Web Server Controls
Securing Data Access in ASP.NET
ObjectDataSource Web Server Control Overview
Binding Data to the TreeView Web Server Control