protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e) { if (e.Exception != null) { // An exception occurred during the data operation // Handle the exception here } else { // The data operation was successful int rowCount = e.ReturnValue.Count; // Do something with the returned data } }
protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["parameter1"] = "new value"; }In this example, the code is executed before a data operation is performed by the ObjectDataSource control. The Selecting event is raised before the operation, and allows you to modify the input parameters that will be used in the operation. In this case, the value of the "parameter1" parameter is being changed to "new value". The package library for ObjectDataSourceStatusEventArgs is part of the System.Web assembly.