ObjectDataSourceEventArgs.ObjectInstance Property

Gets or sets an object that represents the business object with which the ObjectDataSource control performs data operations.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
property Object^ ObjectInstance {
	Object^ get ();
	void set (Object^ value);
}
/** @property */
public Object get_ObjectInstance ()

/** @property */
public void set_ObjectInstance (Object value)

public function get ObjectInstance () : Object

public function set ObjectInstance (value : Object)

Not applicable.

Property Value

The business object the ObjectDataSource uses to perform data operations; otherwise, a null reference (Nothing in Visual Basic), if a null reference (Nothing in Visual Basic) is passed to the ObjectDataSourceEventArgs.

This section contains two code examples. The first code example demonstrates how to use an ObjectDataSource control with a business object and a GridView control to retrieve and display information. The second code example provides the example basic business object that the first code example uses.

The following code example demonstrates how to use an ObjectDataSource control with a business object and a GridView control to retrieve and display information. In this example, as in many real-world scenarios, it might not be possible nor appropriate to use a default instance of the business object with the ObjectDataSource control. In this example, the ObjectDataSource cannot successfully call the default constructor because it will throw an exception. In some cases, the default constructor might be protected and in others it might not initialize the business object to a desired state. Whatever the reason, you can create an instance of the business object yourself and set the instance to the ObjectInstance property of the ObjectDataSourceEventArgs object that is passed to the handler. This is the business object instance that the ObjectDataSource will use to perform its work.

No code example is currently available or this language may not be supported.

The following code example demonstrates the example basic business object that the preceding code example uses.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: