Objectdatasource delete null




















If a parameter in the DeleteParameters element is found with the same name as a parameter that is already in the DeleteParameters collection, the existing parameter is modified to match the parameter that is specified in the DeleteParameters element. Typically, this is used to modify the type of the data in the parameter. Finally, you can programmatically add and remove parameters in the Deleting event, which occurs before the Delete method is run.

The method is resolved after the parameters are merged. Method resolution is discussed in the next section. When the Delete method is called, the data fields from the data-bound control, the parameters that were created declaratively in the DeleteParameters element, and the parameters that were added in the Deleting event handler are all merged.

For more information, see the preceding section. The ObjectDataSource object then attempts to find a method to call. First, it looks for one or more methods with the name that is specified in the DeleteMethod property. If no match is found, an InvalidOperationException exception is thrown. If a match is found, it then looks for matching parameter names.

For example, suppose the type that is specified by the TypeName property has two methods named DeleteARecord. The type of the parameter is not checked in resolving the methods. The order of the parameters does not matter. Message; e. Improve this answer. Kevin Kevin 2 2 silver badges 10 10 bronze badges. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The other parameter comes from the declarative DeleteParameters property. The EmployeeLogic class overloads the DeleteEmployee method. When the event handler exists, the matching DeleteEmployee method is called.

The following code example shows the Web page that displays the DataGrid control and handles the Deleting event.

The following code example shows the EmployeeLogic class that is used in the preceding code example. The names and types of the parameters that are contained in the DeleteParameters collection must match the names and types of the parameters in the DeleteMethod method signature. The parameter names are affected by the OldValuesParameterFormatString property and are case-sensitive.

The parameters in the collection depend on the data that is in the data-bound control, the parameters that are specified declaratively, and the parameters that are added programmatically. The ObjectDataSource automatically caches data when the EnableCaching property is set to true , and the CacheDuration property is set to the number of seconds that the cache stores data before the cache is discarded.

The ObjectDataSource control allows you to cache all types of data, but you should not cache objects that retain resources or state that cannot be shared to service multiple requests for example, an open SqlDataReader object , because the same instance of the object will be used to service multiple requests. The following table describes the features of the ObjectDataSource control. When you use the ObjectDataSource class to update or insert data, strings that are entered at the client are not automatically converted from the client culture format to the server culture format.

As with all data source controls, the ObjectDataSource control is associated with a data source view class. While the ObjectDataSource control is the interface that the page developer uses to work with data, the ObjectDataSourceView class is the interface that data-bound controls work with. Additionally, the ObjectDataSourceView class describes the capabilities of the data source control, and performs the actual work.

While the ObjectDataSourceView object is exposed by the GetView method, many of its properties and methods are wrapped and exposed directly by the ObjectDataSource control. Behind the scenes, the ObjectDataSourceView object performs all data operations, including retrieving, inserting, updating, deleting, filtering, and sorting the data. For more information, see ObjectDataSourceView. To do so, you set the TypeName property to the name of the data-context class.

You also set the SelectMethod , UpdateMethod , InsertMethod , and DeleteMethod methods to the methods in the data-context class that perform the corresponding operations. You must create an event handler for the ObjectDisposing event in order to cancel disposing of the data-context class. For an example of how to cancel the disposing of a data context class, see the ObjectDisposing event.

Initializes a new instance of the ObjectDataSource class. Initializes a new instance of the ObjectDataSource class with the specified type name and data retrieval method name. Gets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.

Gets or sets the length of time, in seconds, that the data source control caches data that is retrieved by the SelectMethod property. Gets or sets the cache expiration behavior that, when combined with the duration, describes the behavior of the cache that the data source control uses.

Gets or sets a user-defined key dependency that is linked to all data cache objects that are created by the data source control. Gets a character value representing the separator character used in the ClientID property. Gets or sets a value that determines whether or not just the new values are passed to the Update method or both the old and new values are passed to the Update method. Gets the HttpContext object associated with the server control for the current Web request.

Gets a ControlCollection object that represents the child controls for a specified server control in the UI hierarchy. Gets or sets a value indicating whether the Parameter values that are passed to an update, insert, or delete operation are automatically converted from null to the Value value by the ObjectDataSource control. Gets a reference to the naming container if the naming container implements IDataItemContainer.

Gets a reference to the naming container if the naming container implements IDataKeysControl. Gets or sets the name of a class that the ObjectDataSource control uses for a parameter in an update, insert, or delete data operation, instead of passing individual values from the data-bound control. Gets or sets the name of the method or function that the ObjectDataSource control invokes to delete data.

Gets the parameters collection that contains the parameters that are used by the DeleteMethod method. Gets or sets a value indicating whether the ObjectDataSource control has data caching enabled.

Gets or sets a value that indicates whether the data source control supports paging through the set of data that it retrieves. Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client. Gets or sets a filtering expression that is applied when the method that is specified by the SelectMethod property is called.

Gets a collection of parameters that are associated with any parameter placeholders in the FilterExpression string. Gets a value indicating whether the current server control's child controls have any saved view-state settings.

Gets or sets the name of the method or function that the ObjectDataSource control invokes to insert data. Gets the parameters collection that contains the parameters that are used by the InsertMethod property. Gets a value indicating whether the control participates in loading its view state by ID instead of index. Gets or sets the name of the business object data retrieval method parameter that is used to indicate the number of records to retrieve for data source paging support.

Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same ID property value. Gets or sets a format string to apply to the names of the parameters for original values that are passed to the Delete or Update methods. Gets a reference to the Page instance that contains the server control. Gets a or sets a value that indicates what culture information is used when converting string values to actual property types in order to construct an object of the type indicated by DataObjectTypeName.

Gets or sets the name of the method or function that the ObjectDataSource control invokes to retrieve a row count. Gets or sets the name of the method or function that the ObjectDataSource control invokes to retrieve data. Gets a collection of parameters that are used by the method specified by the SelectMethod property. Gets information about the container that hosts the current control when rendered on a design surface.

Gets the skin to apply to the DataSourceControl control. Gets or sets the name of the business object that the SelectMethod parameter used to specify a sort expression for data source sorting support. Gets or sets a semicolon-delimited string that indicates which databases and tables to use for the Microsoft SQL Server cache dependency. Gets or sets the name of the data retrieval method parameter that is used to indicate the value of the identifier of the first record to retrieve for data source paging support.

Gets the virtual directory of the Page or UserControl that contains the current server control. Gets or sets the name of the class that the ObjectDataSource object represents. Gets or sets the name of the method or function that the ObjectDataSource control invokes to update data. Gets the parameters collection that contains the parameters that are used by the method that is specified by the UpdateMethod property.

Gets or sets a value that indicates whether the control checks client input from the browser for potentially dangerous values. Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page.

Gets a value that indicates whether the StateBag object is case-insensitive. Called after a child control is added to the Controls collection of the Control object.

Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page. Sets the cached ClientID value to null. Deletes the view-state and control-state information for all the server control's child controls. Called by the ASP. NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.

Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event. Performs a delete operation by calling the method that is identified by the DeleteMethod property with any parameters that are in the DeleteParameters collection. Determines whether the server control contains child controls. If it does not, it creates child controls. Searches the current naming container for a server control with the specified id parameter.

Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search.



0コメント

  • 1000 / 1000