asp.net.ph

Skip Navigation Links

ObjectDataSource Control Syntax

ASP.NET Syntax   ASP.NET Syntax for Web Controls


Enables declarative data-binding to data exposed by a custom business object for use in multi-tier Web application architectures.

Declarative Syntax

For information on the individual members of this class, see ObjectDataSource in the class library.

Remarks

The ObjectDataSource control is an ASP.NET data source control that represents a data-aware middle-tier object or a data-interface object to data-bound controls. You can use the ObjectDataSource control in conjunction with a data-bound control to display, edit, and sort data on a Web page with little or no code.

Syntax Example

The following example demonstrates how to use a GridView control to display data using an ObjectDataSource control on a Web Forms page. The ObjectDataSource identifies the partially or fully qualified class name of a business object with its TypeName property and a business object method that is called to retrieve data with its SelectMethod property. At run time, the object is created and the method is called using reflection. The GridView control enumerates through the IEnumerable collection that is returned by the SelectMethod and displays the data.

For an example of a middle-tier business object that could be used with this example, see the class overview for ObjectDataSource.

<asp:gridview
   id="GridView1"
   runat="server"
   datasourceid="ObjectDataSource1" />

<asp:objectdatasource
   id="ObjectDataSource1"
   runat="server"
   selectmethod = "GetAllEmployees"
   typename = "Samples.AspNet.CS.EmployeeLogic" />
See Also

ObjectDataSource Class   ObjectDataSource Web Server Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note