Occurs before an Update operation.
Assembly: System.Web (in System.Web.dll)
Handle the ObjectDataSource control performs the update operation. The parameters are available as an IDictionary collection that is accessed by the InputParameters property, which is exposed by the ObjectDataSourceMethodEventArgs object.event to perform additional initialization that is specific to your application, to validate the values of parameters, or to change the parameter values before the
For more information about handling events, see NIB: Consuming Events.
The following three examples show a Web page, a code-behind page class, and a data-access class that enable a user to retrieve and update records in the Employees table in the Northwind database.
The first example shows a Web page that contains two ObjectDataSource controls, a DropDownList control, and a DetailsView control. The first ObjectDataSource control and the DropDownList control are used to retrieve and display employee names from the database. The second ObjectDataSource control and the DetailsView control are used to retrieve, display, and modify the data from the employee record that is selected by the user.
The second example shows handlers for the Selected and events. The Selected event handler serializes the object that contains data that was retrieved from the Employee table. The serialized object is stored in view state. The event handler deserializes the object in view state that contains the original data for the data record that is being updated. The object that contains the original data is passed as a parameter to the Update method. The original data must be passed to the database so that it can be used to check whether the data has been modified by another process.
The third example shows the data access class that interacts with the Northwind database. The class uses LINQ to query and update the Employees table. The example requires a LINQ to SQL class that represents the Northwind database and Employees table. For more information, see How to: Create LINQ to SQL Classes in a Web Project.
Available since 2.0